lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1430130 [17/27] - in /lucene/dev/branches/lucene4547: ./ dev-tools/ dev-tools/eclipse/ dev-tools/idea/.idea/libraries/ dev-tools/maven/ dev-tools/maven/solr/ dev-tools/maven/solr/contrib/analysis-extras/ dev-tools/maven/solr/contrib/cluste...
Date Tue, 08 Jan 2013 03:40:37 GMT
Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java Tue Jan  8 03:40:16 2013
@@ -125,6 +125,7 @@ public class JdbcDataSource extends
     }
 
     return factory = new Callable<Connection>() {
+      @Override
       public Connection call() throws Exception {
         LOG.info("Creating a connection for entity "
                 + context.getEntityAttribute(DataImporter.NAME) + " with URL: "
@@ -257,14 +258,17 @@ public class JdbcDataSource extends
       }
 
       rSetIterator = new Iterator<Map<String, Object>>() {
+        @Override
         public boolean hasNext() {
           return hasnext();
         }
 
+        @Override
         public Map<String, Object> next() {
           return getARow();
         }
 
+        @Override
         public void remove() {/* do nothing */
         }
       };

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrQueryEscapingEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrQueryEscapingEvaluator.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrQueryEscapingEvaluator.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrQueryEscapingEvaluator.java Tue Jan  8 03:40:16 2013
@@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.util
  */
 
 public class SolrQueryEscapingEvaluator extends Evaluator {
+  @Override
   public String evaluate(String expression, Context context) {
     List<Object> l = parseParams(expression, context.getVariableResolver());
     if (l.size() != 1) {

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java Tue Jan  8 03:40:16 2013
@@ -316,6 +316,7 @@ public class XPathEntityProcessor extend
       } else {
         try {
           xpathReader.streamRecords(data, new XPathRecordReader.Handler() {
+            @Override
             @SuppressWarnings("unchecked")
             public void handle(Map<String, Object> record, String xpath) {
               rows.add(readRow(record, xpath));
@@ -425,6 +426,7 @@ public class XPathEntityProcessor extend
       public void run() {
         try {
           xpathReader.streamRecords(data, new XPathRecordReader.Handler() {
+            @Override
             @SuppressWarnings("unchecked")
             public void handle(Map<String, Object> record, String xpath) {
               if (isEnd.get()) {
@@ -475,10 +477,12 @@ public class XPathEntityProcessor extend
       private Map<String, Object> lastRow;
       int count = 0;
 
+      @Override
       public boolean hasNext() {
         return !isEnd.get();
       }
 
+      @Override
       public Map<String, Object> next() {
         Map<String, Object> row;
         
@@ -514,6 +518,7 @@ public class XPathEntityProcessor extend
         return lastRow = row;
       }
 
+      @Override
       public void remove() {
         /*no op*/
       }

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java Tue Jan  8 03:40:16 2013
@@ -164,6 +164,7 @@ public class XPathRecordReader {
   public List<Map<String, Object>> getAllRecords(Reader r) {
     final List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
     streamRecords(r, new Handler() {
+      @Override
       public void handle(Map<String, Object> record, String s) {
         results.add(record);
       }

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java Tue Jan  8 03:40:16 2013
@@ -81,6 +81,7 @@ public class AbstractDIHCacheTestCase {
       this.data = data;
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public int compareTo(ControlData cd) {
       Comparable c1 = (Comparable) data[0];
@@ -88,6 +89,7 @@ public class AbstractDIHCacheTestCase {
       return c1.compareTo(c2);
     }
 
+    @Override
     public Iterator<Object> iterator() {
       return Arrays.asList(data).iterator();
     }

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHJdbcTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHJdbcTestCase.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHJdbcTestCase.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHJdbcTestCase.java Tue Jan  8 03:40:16 2013
@@ -206,6 +206,7 @@ public abstract class AbstractDIHJdbcTes
   
   public static class DerbyUtil {
     public static final OutputStream DEV_NULL = new OutputStream() {
+      @Override
       public void write(int b) {}
     };
   }

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java Tue Jan  8 03:40:16 2013
@@ -39,6 +39,7 @@ public class MockInitialContextFactory i
     try {
       EasyMock.expect(context.lookup((String) EasyMock.anyObject())).andAnswer(
           new IAnswer<Object>() {
+            @Override
             public Object answer() throws Throwable {
               return objects.get(EasyMock.getCurrentArguments()[0]);
             }
@@ -51,6 +52,7 @@ public class MockInitialContextFactory i
     mockControl.replay();
   }
 
+  @Override
   @SuppressWarnings("unchecked")
   public javax.naming.Context getInitialContext(Hashtable env) {
     return context;

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java Tue Jan  8 03:40:16 2013
@@ -107,7 +107,13 @@ public class TestBuiltInEvaluators exten
     org.junit.Assert.assertEquals("c\\:t", s);
     
   }
-
+  
+  private Date getNow() {
+    Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT"),
+        Locale.ROOT);
+    calendar.add(Calendar.DAY_OF_YEAR, -2);
+    return calendar.getTime();
+  }
   
   @Test
   public void testDateFormatEvaluator() {
@@ -116,23 +122,26 @@ public class TestBuiltInEvaluators exten
         Context.FULL_DUMP, Collections.<String,Object> emptyMap(), null, null);
     String currentLocale = Locale.getDefault().toString();
     {
-      Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT"),
-          Locale.ROOT);
-      calendar.add(Calendar.DAY_OF_YEAR, -2);
-      Date d = calendar.getTime();
       {
-        String sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ROOT).format(d);
-        String dfe = dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH:mm'", context);
+        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH", Locale.ROOT);
+        String sdf = sdfDate.format(getNow());
+        String dfe = dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH'", context);
         assertEquals(sdf,dfe);
       }
       {
-        String sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()).format(d);
-        String dfe = dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH:mm','"+ currentLocale + "'", context);
+        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH", Locale.getDefault());
+        String sdf = sdfDate.format(getNow());
+        String dfe = dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH','"+ currentLocale + "'", context);
         assertEquals(sdf,dfe);
+        for(String tz : TimeZone.getAvailableIDs()) {          
+          sdfDate.setTimeZone(TimeZone.getTimeZone(tz));
+          sdf = sdfDate.format(getNow());
+          dfe = dateFormatEval.evaluate("'NOW-2DAYS','yyyy-MM-dd HH','" + currentLocale + "','" + tz + "'", context);
+          assertEquals(sdf,dfe);          
+        }
       }
     }
-    Date d = new Date();
-    
+    Date d = new Date();    
     Map<String,Object> map = new HashMap<String,Object>();
     map.put("key", d);
     resolver.addNamespace("A", map);
@@ -144,6 +153,15 @@ public class TestBuiltInEvaluators exten
         new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()).format(d),
         dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm','" + currentLocale
             + "'", context));
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
+    for(String tz : TimeZone.getAvailableIDs()) {
+      sdf.setTimeZone(TimeZone.getTimeZone(tz));
+      assertEquals(
+          sdf.format(d),
+          dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm','" + currentLocale + "', '" + tz + "'", context));     
+      
+    }
+    
     
   }
 

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java Tue Jan  8 03:40:16 2013
@@ -46,6 +46,7 @@ public class TestClobTransformer extends
     Transformer t = new ClobTransformer();
     Map<String, Object> row = new HashMap<String, Object>();
     Clob clob = (Clob) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Clob.class}, new InvocationHandler() {
+      @Override
       public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
         if (method.getName().equals("getCharacterStream")) {
           return new StringReader("hello!");

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java Tue Jan  8 03:40:16 2013
@@ -285,6 +285,7 @@ public class TestDocBuilder2 extends Abs
   public static class StartEventListener implements EventListener {
     public static boolean executed = false;
 
+    @Override
     public void onEvent(Context ctx) {
       executed = true;
     }
@@ -293,6 +294,7 @@ public class TestDocBuilder2 extends Abs
   public static class EndEventListener implements EventListener {
     public static boolean executed = false;
 
+    @Override
     public void onEvent(Context ctx) {
       executed = true;
     }

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestNonWritablePersistFile.java Tue Jan  8 03:40:16 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.handler.dataimport;
 
+import org.apache.commons.io.FileUtils;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -46,12 +48,22 @@ public class TestNonWritablePersistFile 
     "    </entity>\n" +
     "  </document>\n" +
     "</dataConfig>\n";
+  private static String tmpSolrHome;
 
   @BeforeClass
-  public static void beforeClass() throws Exception {
-    initCore("dataimport-solrconfig.xml", "dataimport-schema.xml");
+  public static void createTempSolrHomeAndCore() throws Exception {
+    createTempDir();
+    tmpSolrHome = TEMP_DIR + File.separator + TestNonWritablePersistFile.class.getSimpleName() + System.currentTimeMillis();
+    FileUtils.copyDirectory(getFile("dih/solr"), new File(tmpSolrHome).getAbsoluteFile());
+    initCore("dataimport-solrconfig.xml", "dataimport-schema.xml", 
+             new File(tmpSolrHome).getAbsolutePath());
   }  
   
+  @AfterClass
+  public static void destroyTempSolrHomeAndCore() throws Exception {
+    FileUtils.deleteDirectory(new File(tmpSolrHome).getAbsoluteFile());
+  }
+
   @Test
   @SuppressWarnings("unchecked")
   public void testNonWritablePersistFile() throws Exception {

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSimplePropertiesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSimplePropertiesWriter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSimplePropertiesWriter.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSimplePropertiesWriter.java Tue Jan  8 03:40:16 2013
@@ -1,6 +1,10 @@
 package org.apache.solr.handler.dataimport;
 
 import java.io.File;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -95,9 +99,7 @@ public class TestSimplePropertiesWriter 
       props = spw.readIndexerProperties();
       Date entityDate = df.parse((String) props.get("SomeDates.last_index_time"));
       Date docDate= df.parse((String) props.get("last_index_time"));
-      Calendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT"), Locale.ROOT);
-      c.setTime(docDate);
-      int year = c.get(Calendar.YEAR);
+      int year = currentYearFromDatabase();
       
       Assert.assertTrue("This date: " + errMsgFormat.format(oneSecondAgo) + " should be prior to the document date: " + errMsgFormat.format(docDate), docDate.getTime() - oneSecondAgo.getTime() > 0);
       Assert.assertTrue("This date: " + errMsgFormat.format(oneSecondAgo) + " should be prior to the entity date: " + errMsgFormat.format(entityDate), entityDate.getTime() - oneSecondAgo.getTime() > 0);   
@@ -105,6 +107,34 @@ public class TestSimplePropertiesWriter 
     }
   }
   
+  private int currentYearFromDatabase() throws Exception {
+    Connection conn = null;
+    Statement s = null;
+    ResultSet rs = null;
+    try {
+      conn = newConnection();
+      s = conn.createStatement();
+      rs = s.executeQuery("select year(current_timestamp) from sysibm.sysdummy1");
+      if (rs.next()) {
+        return rs.getInt(1);
+      }
+      Assert.fail("We should have gotten a row from the db.");
+    } catch (SQLException e) {
+      throw e;
+    } finally {
+      try {
+        rs.close();
+      } catch (Exception ex) {}
+      try {
+        s.close();
+      } catch (Exception ex) {}
+      try {
+        conn.close();
+      } catch (Exception ex) {}
+    }
+    return 0;
+  }
+  
   @Override
   protected Database setAllowedDatabases() {
     return Database.DERBY;

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorEndToEnd.java Tue Jan  8 03:40:16 2013
@@ -30,7 +30,6 @@ import org.apache.commons.io.FileUtils;
 import org.apache.http.client.HttpClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.common.SolrInputDocument;
 import org.junit.After;
@@ -47,11 +46,11 @@ public class TestSolrEntityProcessorEndT
   
   private static Logger LOG = LoggerFactory.getLogger(TestSolrEntityProcessorEndToEnd.class);
   
-  //rivate static final String SOLR_SOURCE_URL = "http://127.0.0.1:8983/solr";
   private static final String SOLR_CONFIG = "dataimport-solrconfig.xml";
   private static final String SOLR_SCHEMA = "dataimport-schema.xml";
-  private static final String SOLR_HOME = "dih/solr";
-  private static final String CONF_DIR = "dih" + File.separator + "solr" + File.separator + "collection1" + File.separator + "conf" + File.separator;
+  private static final String SOURCE_CONF_DIR = "dih" + File.separator + "solr" + File.separator + "collection1" + File.separator + "conf" + File.separator;
+  
+  private static final String DEAD_SOLR_SERVER = "http://[ff01::114]:33332/solr";
   
   private static final List<Map<String,Object>> DB_DOCS = new ArrayList<Map<String,Object>>();
   private static final List<Map<String,Object>> SOLR_DOCS = new ArrayList<Map<String,Object>>();
@@ -73,7 +72,7 @@ public class TestSolrEntityProcessorEndT
   private SolrInstance instance = null;
   private JettySolrRunner jetty;
   
-  private static String getDihConfigTagsInnerEntity(int port) {
+  private String getDihConfigTagsInnerEntity() {
     return  "<dataConfig>\r\n"
         + "  <dataSource type='MockDataSource' />\r\n"
         + "  <document>\r\n"
@@ -81,21 +80,21 @@ public class TestSolrEntityProcessorEndT
         + "      <field column='dbid_s' />\r\n"
         + "      <field column='dbdesc_s' />\r\n"
         + "      <entity name='se' processor='SolrEntityProcessor' query='id:${db.dbid_s}'\n"
-        + "     url='" + getSourceUrl(port) + "' fields='id,desc'>\r\n"
+        + "     url='" + getSourceUrl() + "' fields='id,desc'>\r\n"
         + "        <field column='id' />\r\n"
         + "        <field column='desc' />\r\n" + "      </entity>\r\n"
         + "    </entity>\r\n" + "  </document>\r\n" + "</dataConfig>\r\n";
   }
   
-  private static String generateDIHConfig(String options, int port) {
+  private String generateDIHConfig(String options, boolean useDeadServer) {
     return "<dataConfig>\r\n" + "  <document>\r\n"
         + "    <entity name='se' processor='SolrEntityProcessor'" + "   url='"
-        + getSourceUrl(port) + "' " + options + " />\r\n" + "  </document>\r\n"
+        + (useDeadServer ? DEAD_SOLR_SERVER : getSourceUrl()) + "' " + options + " />\r\n" + "  </document>\r\n"
         + "</dataConfig>\r\n";
   }
   
-  private static String getSourceUrl(int port) {
-    return "http://127.0.0.1:" + port + "/solr";
+  private String getSourceUrl() {
+    return "http://127.0.0.1:" + jetty.getLocalPort() + "/solr";
   }
   
   //TODO: fix this test to close its directories
@@ -120,7 +119,7 @@ public class TestSolrEntityProcessorEndT
   public void setUp() throws Exception {
     super.setUp();
     // destination solr core
-    initCore(SOLR_CONFIG, SOLR_SCHEMA, SOLR_HOME);
+    initCore(SOLR_CONFIG, SOLR_SCHEMA);
     // data source solr instance
     instance = new SolrInstance();
     instance.setUp();
@@ -145,7 +144,7 @@ public class TestSolrEntityProcessorEndT
     
     try {
       addDocumentsToSolr(SOLR_DOCS);
-      runFullImport(generateDIHConfig("query='*:*' rows='2' fl='id,desc' onError='skip'", jetty.getLocalPort()));
+      runFullImport(generateDIHConfig("query='*:*' rows='2' fl='id,desc' onError='skip'", false));
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -163,7 +162,7 @@ public class TestSolrEntityProcessorEndT
       addDocumentsToSolr(generateSolrDocuments(30));
       Map<String,String> map = new HashMap<String,String>();
       map.put("rows", "50");
-      runFullImport(generateDIHConfig("query='*:*' fq='desc:Description1*,desc:Description*2' rows='2'", jetty.getLocalPort()), map);
+      runFullImport(generateDIHConfig("query='*:*' fq='desc:Description1*,desc:Description*2' rows='2'", false), map);
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -178,7 +177,7 @@ public class TestSolrEntityProcessorEndT
     
     try {
       addDocumentsToSolr(generateSolrDocuments(7));
-      runFullImport(generateDIHConfig("query='*:*' fl='id' rows='2'", jetty.getLocalPort()));
+      runFullImport(generateDIHConfig("query='*:*' fl='id' rows='2'", false));
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -204,7 +203,7 @@ public class TestSolrEntityProcessorEndT
     try {
       MockDataSource.setIterator("select * from x", DB_DOCS.iterator());
       addDocumentsToSolr(SOLR_DOCS);
-      runFullImport(getDihConfigTagsInnerEntity(jetty.getLocalPort()));
+      runFullImport(getDihConfigTagsInnerEntity());
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -221,17 +220,10 @@ public class TestSolrEntityProcessorEndT
   }
   
   public void testFullImportWrongSolrUrl() {
-    try {
-      jetty.stop();
-    } catch (Exception e) {
-      LOG.error("Error stopping jetty", e);
-      fail(e.getMessage());
-    }
-    
     assertQ(req("*:*"), "//result[@numFound='0']");
     
     try {
-      runFullImport(generateDIHConfig("query='*:*' rows='2' fl='id,desc' onError='skip'", jetty.getLocalPort()));
+      runFullImport(generateDIHConfig("query='*:*' rows='2' fl='id,desc' onError='skip'", true /* use dead server */));
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -244,7 +236,7 @@ public class TestSolrEntityProcessorEndT
     assertQ(req("*:*"), "//result[@numFound='0']");
     
     try {
-      runFullImport(generateDIHConfig("query='bogus:3' rows='2' fl='id,desc' onError='abort'", jetty.getLocalPort()));
+      runFullImport(generateDIHConfig("query='bogus:3' rows='2' fl='id,desc' onError='abort'", false));
     } catch (Exception e) {
       LOG.error(e.getMessage(), e);
       fail(e.getMessage());
@@ -274,9 +266,9 @@ public class TestSolrEntityProcessorEndT
       sidl.add(sd);
     }
     
-    HttpClient client = HttpClientUtil.createClient(null);
-    URL url = new URL(getSourceUrl(jetty.getLocalPort()));
-    HttpSolrServer solrServer = new HttpSolrServer(url.toExternalForm(), client);
+    HttpSolrServer solrServer = new HttpSolrServer(getSourceUrl());
+    solrServer.setConnectionTimeout(15000);
+    solrServer.setSoTimeout(30000);
     solrServer.add(sidl);
     solrServer.commit(true, true);
   }
@@ -291,7 +283,7 @@ public class TestSolrEntityProcessorEndT
     }
     
     public String getSchemaFile() {
-      return CONF_DIR + "dataimport-schema.xml";
+      return SOURCE_CONF_DIR + "dataimport-schema.xml";
     }
     
     public String getDataDir() {
@@ -299,7 +291,7 @@ public class TestSolrEntityProcessorEndT
     }
     
     public String getSolrConfigFile() {
-      return CONF_DIR + "dataimport-solrconfig.xml";
+      return SOURCE_CONF_DIR + "dataimport-solrconfig.xml";
     }
     
     public void setUp() throws Exception {
@@ -321,7 +313,7 @@ public class TestSolrEntityProcessorEndT
       
       FileUtils.copyFile(getFile(getSchemaFile()), f);
       f = new File(confDir, "data-config.xml");
-      FileUtils.copyFile(getFile(CONF_DIR + "dataconfig-contentstream.xml"), f);
+      FileUtils.copyFile(getFile(SOURCE_CONF_DIR + "dataconfig-contentstream.xml"), f);
     }
     
     public void tearDown() throws Exception {

Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java Tue Jan  8 03:40:16 2013
@@ -139,6 +139,7 @@ public class TestXPathRecordReader exten
     final List<Map<String, Object>> a = new ArrayList<Map<String, Object>>();
     final List<Map<String, Object>> x = new ArrayList<Map<String, Object>>();
     rr.streamRecords(new StringReader(xml), new XPathRecordReader.Handler() {
+      @Override
       public void handle(Map<String, Object> record, String xpath) {
         if (record == null) return;
         if (xpath.equals("/root/a")) a.add(record);

Modified: lucene/dev/branches/lucene4547/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java Tue Jan  8 03:40:16 2013
@@ -64,6 +64,7 @@ public class ExtractingRequestHandler ex
     super.init(args);
   }
 
+  @Override
   public void inform(SolrCore core) {
     if (initArgs != null) {
       //if relative,then relative to config dir, otherwise, absolute path

Modified: lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java Tue Jan  8 03:40:16 2013
@@ -61,6 +61,7 @@ public class LangDetectLanguageIdentifie
   protected SolrParams appends;
   protected SolrParams invariants;
 
+  @Override
   public void inform(SolrCore core) {
   }
 
@@ -69,6 +70,7 @@ public class LangDetectLanguageIdentifie
    * to a RequestHandler, with defaults, appends and invariants.
    * @param args a NamedList with the configuration parameters 
    */
+  @Override
   @SuppressWarnings("rawtypes")
   public void init( NamedList args )
   {

Modified: lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java Tue Jan  8 03:40:16 2013
@@ -49,6 +49,7 @@ public class TikaLanguageIdentifierUpdat
   protected SolrParams appends;
   protected SolrParams invariants;
 
+  @Override
   public void inform(SolrCore core) {
   }
 
@@ -57,6 +58,7 @@ public class TikaLanguageIdentifierUpdat
    * to a RequestHandler, with defaults, appends and invariants.
    * @param args a NamedList with the configuration parameters 
    */
+  @Override
   @SuppressWarnings("rawtypes")
   public void init( NamedList args )
   {

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java Tue Jan  8 03:40:16 2013
@@ -20,6 +20,7 @@ package org.apache.solr.uima.processor;
 /**
  * Exception thrown when an error happening while mapping UIMA CAS model to Solr fields
  */
+@SuppressWarnings("serial")
 public class FieldMappingException extends Exception {
   public FieldMappingException(Exception e) {
     super(e);

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java Tue Jan  8 03:40:16 2013
@@ -17,8 +17,6 @@ package org.apache.solr.uima.processor;
  * limitations under the License.
  */
 
-import java.net.URL;
-import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java Tue Jan  8 03:40:16 2013
@@ -24,6 +24,7 @@ public class DummySentimentAnnotation ex
    */
   public final static int type = typeIndexID;
   /** @generated  */
+  @Override
   public              int getTypeIndexID() {return typeIndexID;}
  
   /** Never called.  Disable default constructor

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java Tue Jan  8 03:40:16 2013
@@ -17,10 +17,12 @@ import org.apache.uima.jcas.tcas.Annotat
  * @generated */
 public class DummySentimentAnnotation_Type extends Annotation_Type {
   /** @generated */
+  @Override
   protected FSGenerator getFSGenerator() {return fsGenerator;}
   /** @generated */
   private final FSGenerator fsGenerator = 
     new FSGenerator() {
+      @Override
       public FeatureStructure createFS(int addr, CASImpl cas) {
         if (DummySentimentAnnotation_Type.this.useExistingInstance) {
           // Return eq fs instance if already created

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation.java Tue Jan  8 03:40:16 2013
@@ -24,6 +24,7 @@ public class EntityAnnotation extends An
    */
   public final static int type = typeIndexID;
   /** @generated  */
+  @Override
   public              int getTypeIndexID() {return typeIndexID;}
  
   /** Never called.  Disable default constructor

Modified: lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation_Type.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation_Type.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation_Type.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/uima/src/test/org/apache/solr/uima/ts/EntityAnnotation_Type.java Tue Jan  8 03:40:16 2013
@@ -17,10 +17,12 @@ import org.apache.uima.jcas.tcas.Annotat
  * @generated */
 public class EntityAnnotation_Type extends Annotation_Type {
   /** @generated */
+  @Override
   protected FSGenerator getFSGenerator() {return fsGenerator;}
   /** @generated */
   private final FSGenerator fsGenerator = 
     new FSGenerator() {
+      @Override
       public FeatureStructure createFS(int addr, CASImpl cas) {
          if (EntityAnnotation_Type.this.useExistingInstance) {
            // Return eq fs instance if already created

Modified: lucene/dev/branches/lucene4547/solr/contrib/velocity/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/velocity/ivy.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/velocity/ivy.xml (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/velocity/ivy.xml Tue Jan  8 03:40:16 2013
@@ -21,7 +21,7 @@
     <dependencies>
       <dependency org="commons-beanutils" name="commons-beanutils" rev="1.7.0" transitive="false"/>
       <dependency org="commons-collections" name="commons-collections" rev="3.2.1" transitive="false"/>
-      <dependency org="org.apache.velocity" name="velocity" rev="1.6.4" transitive="false"/>
+      <dependency org="org.apache.velocity" name="velocity" rev="1.7" transitive="false"/>
       <dependency org="org.apache.velocity" name="velocity-tools" rev="2.0" transitive="false"/>
       <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
     </dependencies>

Modified: lucene/dev/branches/lucene4547/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Tue Jan  8 03:40:16 2013
@@ -30,8 +30,6 @@ import org.apache.velocity.runtime.Runti
 import org.apache.velocity.tools.generic.*;
 
 import java.io.*;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
 public class VelocityResponseWriter implements QueryResponseWriter {
@@ -39,6 +37,7 @@ public class VelocityResponseWriter impl
   // TODO: maybe pass this Logger to the template for logging from there?
 //  private static final Logger log = LoggerFactory.getLogger(VelocityResponseWriter.class);
 
+  @Override
   public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException {
     VelocityEngine engine = getEngine(request);  // TODO: have HTTP headers available for configuring engine
 
@@ -83,64 +82,6 @@ public class VelocityResponseWriter impl
 
     context.put("engine", engine);  // for $engine.resourceExists(...)
 
-    // Mimetype to extension map for detecting file type and show icon
-    // List of types match the icons in /solr/img/filetypes
-    Map<String, String> mimeToExt = new HashMap<String, String>() {{
-      put("application/x-7z-compressed", "7z");
-      put("application/postscript", "ai");
-      put("application/pgp-signature", "asc");
-      put("application/octet-stream", "bin");
-      put("application/x-bzip2", "bz2");
-      put("text/x-c", "c");
-      put("application/vnd.ms-htmlhelp", "chm");
-      put("application/java-vm", "class");
-      put("text/css", "css");
-      put("text/csv", "csv");
-      put("application/x-debian-package", "deb");
-      put("application/msword", "doc");
-      put("message/rfc822", "eml");
-      put("image/gif", "gif");
-      put("application/winhlp", "hlp");
-      put("text/html", "html");
-      put("application/java-archive", "jar");
-      put("text/x-java-source", "java");
-      put("image/jpeg", "jpeg");
-      put("application/javascript", "js");
-      put("application/vnd.oasis.opendocument.chart", "odc");
-      put("application/vnd.oasis.opendocument.formula", "odf");
-      put("application/vnd.oasis.opendocument.graphics", "odg");
-      put("application/vnd.oasis.opendocument.image", "odi");
-      put("application/vnd.oasis.opendocument.presentation", "odp");
-      put("application/vnd.oasis.opendocument.spreadsheet", "ods");
-      put("application/vnd.oasis.opendocument.text", "odt");
-      put("application/pdf", "pdf");
-      put("application/pgp-encrypted", "pgp");
-      put("image/png", "png");
-      put("application/vnd.ms-powerpoint", "ppt");
-      put("audio/x-pn-realaudio", "ram");
-      put("application/x-rar-compressed", "rar");
-      put("application/vnd.rn-realmedia", "rm");
-      put("application/rtf", "rtf");
-      put("application/x-shockwave-flash", "swf");
-      put("application/vnd.sun.xml.calc", "sxc");
-      put("application/vnd.sun.xml.draw", "sxd");
-      put("application/vnd.sun.xml.impress", "sxi");
-      put("application/vnd.sun.xml.writer", "sxw");
-      put("application/x-tar", "tar");
-      put("application/x-tex", "tex");
-      put("text/plain", "txt");
-      put("text/x-vcard", "vcf");
-      put("application/vnd.visio", "vsd");
-      put("audio/x-wav", "wav");
-      put("audio/x-ms-wma", "wma");
-      put("video/x-ms-wmv", "wmv");
-      put("application/vnd.ms-excel", "xls");
-      put("application/xml", "xml");
-      put("application/x-xpinstall", "xpi");
-      put("application/zip", "zip");
-    }};
-    context.put("mimeToExt", mimeToExt);
-    
     String layout_template = request.getParams().get("v.layout");
     String json_wrapper = request.getParams().get("v.json");
     boolean wrap_response = (layout_template != null) || (json_wrapper != null);
@@ -246,6 +187,7 @@ public class VelocityResponseWriter impl
     return template;
   }
 
+  @Override
   public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
     return request.getParams().get("v.contentType", "text/html;charset=UTF-8");
   }
@@ -260,6 +202,7 @@ public class VelocityResponseWriter impl
     return "{\"result\":\"" + replaced + "\"}";
   }
 
+  @Override
   public void init(NamedList args) {
   }
 }

Modified: lucene/dev/branches/lucene4547/solr/core/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/ivy.xml?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/ivy.xml (original)
+++ lucene/dev/branches/lucene4547/solr/core/ivy.xml Tue Jan  8 03:40:16 2013
@@ -25,10 +25,11 @@
       <dependency org="commons-cli" name="commons-cli" rev="1.2" transitive="false"/>
       <dependency org="commons-lang" name="commons-lang" rev="2.6" transitive="false"/>
       <dependency org="com.google.guava" name="guava" rev="13.0.1" transitive="false"/>
-      <dependency org="org.easymock" name="easymock" rev="2.2" transitive="false"/>
+      <dependency org="org.easymock" name="easymock" rev="3.0" transitive="false"/>
+      <dependency org="cglib" name="cglib-nodep" rev="2.2" transitive="false"/>
+      <dependency org="org.objenesis" name="objenesis" rev="1.2" transitive="false"/>
       <dependency org="com.spatial4j" name="spatial4j" rev="0.3" transitive="false"/>
       <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" transitive="false"/>
-      <dependency org="com.yammer.metrics" name="metrics-core" rev="2.1.2" transitive="false"/>
       <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
     </dependencies>
 </ivy-module>

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/SolrLogFormatter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/SolrLogFormatter.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/SolrLogFormatter.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/SolrLogFormatter.java Tue Jan  8 03:40:16 2013
@@ -196,12 +196,8 @@ sb.append("(group_name=").append(tg.getN
           sb.append(" url="+info.url + " node="+zkController.getNodeName());
         }
 
-        if(info.coreProps == null) {
-          info.coreProps = getCoreProps(zkController, core);
-        }
-
-        Map<String, Object> coreProps = getCoreProps(zkController, core);
-        if(!coreProps.equals(info.coreProps)) {
+        Map<String, Object> coreProps = getReplicaProps(zkController, core);
+        if (info.coreProps == null || !coreProps.equals(info.coreProps)) {
           info.coreProps = coreProps;
           final String corePropsString = "coll:" + core.getCoreDescriptor().getCloudDescriptor().getCollectionName() + " core:" + core.getName() + " props:" + coreProps;
           sb.append(" " + info.shortId + "_STATE=" + corePropsString);
@@ -261,11 +257,11 @@ sb.append("(group_name=").append(tg.getN
     return sb.toString();
   }
 
-  private Map<String,Object> getCoreProps(ZkController zkController, SolrCore core) {
+  private Map<String,Object> getReplicaProps(ZkController zkController, SolrCore core) {
     final String collection = core.getCoreDescriptor().getCloudDescriptor().getCollectionName();
-    Replica props = zkController.getClusterState().getReplica(collection, ZkStateReader.getCoreNodeName(zkController.getNodeName(), core.getName()));
-    if(props!=null) {
-      return props.getProperties(); 
+    Replica replica = zkController.getClusterState().getReplica(collection, ZkStateReader.getCoreNodeName(zkController.getNodeName(), core.getName()));
+    if(replica!=null) {
+      return replica.getProperties();
     }
     return Collections.EMPTY_MAP;
   }
@@ -430,6 +426,7 @@ sb.append("(group_name=").append(tg.getN
     public MyThreadGroup(String name) {
       super(name);
     }
+    @Override
     public String getTag() { return "HELLO"; }
   }
   

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilterFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilterFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/LegacyHTMLStripCharFilterFactory.java Tue Jan  8 03:40:16 2013
@@ -54,6 +54,7 @@ import org.apache.lucene.analysis.util.C
 @Deprecated
 public class LegacyHTMLStripCharFilterFactory extends CharFilterFactory {
 
+  @Override
   public LegacyHTMLStripCharFilter create(Reader input) {
     return new LegacyHTMLStripCharFilter(input);
   }

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java Tue Jan  8 03:40:16 2013
@@ -82,6 +82,7 @@ public class ReversedWildcardFilterFacto
   }
 
 
+  @Override
   public TokenStream create(TokenStream input) {
     return new ReversedWildcardFilter(input, withOriginal, markerChar);
   }

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/analysis/TrieTokenizerFactory.java Tue Jan  8 03:40:16 2013
@@ -48,40 +48,56 @@ public class TrieTokenizerFactory extend
     this.precisionStep = precisionStep;
   }
 
+  @Override
   public TrieTokenizer create(Reader input) {
-    return new TrieTokenizer(input, type, precisionStep, TrieTokenizer.getNumericTokenStream(precisionStep));
+    return new TrieTokenizer(input, type, TrieTokenizer.getNumericTokenStream(precisionStep));
   }
 }
 
 final class TrieTokenizer extends Tokenizer {
   protected static final DateField dateField = new DateField();
-  protected final int precisionStep;
   protected final TrieTypes type;
   protected final NumericTokenStream ts;
   
   protected final OffsetAttribute ofsAtt = addAttribute(OffsetAttribute.class);
   protected int startOfs, endOfs;
+  protected boolean hasValue;
+  protected final char[] buf = new char[32];
 
   static NumericTokenStream getNumericTokenStream(int precisionStep) {
     return new NumericTokenStream(precisionStep);
   }
 
-  public TrieTokenizer(Reader input, TrieTypes type, int precisionStep, NumericTokenStream ts) {
+  public TrieTokenizer(Reader input, TrieTypes type, NumericTokenStream ts) {
     // must share the attribute source with the NumericTokenStream we delegate to
     super(ts, input);
     this.type = type;
-    this.precisionStep = precisionStep;
     this.ts = ts;
   }
 
   @Override
   public void reset() {
    try {
-      char[] buf = new char[32];
-      int len = input.read(buf);
+      int upto = 0;
+      while (upto < buf.length) {
+        final int length = input.read(buf, upto, buf.length - upto);
+        if (length == -1) break;
+        upto += length;
+      }
+      // skip remaining data if buffer was too short:
+      if (upto == buf.length) {
+        input.skip(Long.MAX_VALUE);
+      }
+
       this.startOfs = correctOffset(0);
-      this.endOfs = correctOffset(len);
-      String v = new String(buf, 0, len);
+      this.endOfs = correctOffset(upto);
+      
+      if (upto == 0) {
+        hasValue = false;
+        return;
+      }
+
+      final String v = new String(buf, 0, upto);
       try {
         switch (type) {
           case INTEGER:
@@ -106,21 +122,24 @@ final class TrieTokenizer extends Tokeni
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
                                 "Invalid Number: " + v);
       }
+      hasValue = true;
+      ts.reset();
     } catch (IOException e) {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unable to create TrieIndexTokenizer", e);
     }
-    ts.reset();
   }
 
   @Override
   public void close() throws IOException {
     super.close();
-    ts.close();
+    if (hasValue) {
+      ts.close();
+    }
   }
 
   @Override
   public boolean incrementToken() {
-    if (ts.incrementToken()) {
+    if (hasValue && ts.incrementToken()) {
       ofsAtt.setOffset(startOfs, endOfs);
       return true;
     }
@@ -129,7 +148,9 @@ final class TrieTokenizer extends Tokeni
 
   @Override
   public void end() throws IOException {
-    ts.end();
+    if (hasValue) {
+      ts.end();
+    }
     ofsAtt.setOffset(endOfs, endOfs);
   }
 }

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java Tue Jan  8 03:40:16 2013
@@ -19,13 +19,17 @@ package org.apache.solr.client.solrj.emb
 
 import java.io.IOException;
 import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.LinkedList;
 import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -53,6 +57,7 @@ public class JettySolrRunner {
   Server server;
 
   FilterHolder dispatchFilter;
+  FilterHolder debugFilter;
 
   String context;
 
@@ -73,6 +78,53 @@ public class JettySolrRunner {
 
   private boolean stopAtShutdown;
 
+  public static class DebugFilter implements Filter {
+    public int requestsToKeep = 10;
+    private AtomicLong nRequests = new AtomicLong();
+
+    public long getTotalRequests() {
+      return nRequests.get();
+
+    }
+
+    // TODO: keep track of certain number of last requests
+    private LinkedList<HttpServletRequest> requests = new LinkedList<HttpServletRequest>();
+
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+      nRequests.incrementAndGet();
+
+      /***
+      HttpServletRequest req = (HttpServletRequest)servletRequest;
+      HttpServletResponse resp = (HttpServletResponse)servletResponse;
+
+      String path = req.getServletPath();
+      if( req.getPathInfo() != null ) {
+        // this lets you handle /update/commit when /update is a servlet
+        path += req.getPathInfo();
+      }
+      System.out.println("###################### FILTER request " + servletRequest);
+      System.out.println("\t\tgetServletPath="+req.getServletPath());
+      System.out.println("\t\tgetPathInfo="+req.getPathInfo());
+      ***/
+
+      filterChain.doFilter(servletRequest, servletResponse);
+    }
+
+    @Override
+    public void destroy() {
+    }
+  }
+
+
+
+
+
   public JettySolrRunner(String solrHome, String context, int port) {
     this.init(solrHome, context, port, true);
   }
@@ -102,18 +154,29 @@ public class JettySolrRunner {
     }
     System.setProperty("solr.solr.home", solrHome);
     if (System.getProperty("jetty.testMode") != null) {
-      SelectChannelConnector connector = new SelectChannelConnector();
+      final String connectorName = System.getProperty("tests.jettyConnector", "SelectChannel");
+      final Connector connector;
+      final QueuedThreadPool threadPool;
+      if ("SelectChannel".equals(connectorName)) {
+        final SelectChannelConnector c = new SelectChannelConnector();
+        c.setReuseAddress(true);
+        c.setLowResourcesMaxIdleTime(1500);
+        connector = c;
+        threadPool = (QueuedThreadPool) c.getThreadPool();
+      } else if ("Socket".equals(connectorName)) {
+        final SocketConnector c = new SocketConnector();
+        c.setReuseAddress(true);
+        connector = c;
+        threadPool = (QueuedThreadPool) c.getThreadPool();
+      } else {
+        throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName);
+      }
       connector.setPort(port);
-      connector.setReuseAddress(true);
-      connector.setLowResourcesMaxIdleTime(1500);
-      QueuedThreadPool threadPool = (QueuedThreadPool) connector
-          .getThreadPool();
+      connector.setHost("127.0.0.1");
       if (threadPool != null) {
         threadPool.setMaxThreads(10000);
         threadPool.setMaxIdleTimeMs(5000);
-        if (!stopAtShutdown) {
-          threadPool.setMaxStopTimeMs(100);
-        }
+        threadPool.setMaxStopTimeMs(30000);
       }
       
       server.setConnectors(new Connector[] {connector});
@@ -148,12 +211,15 @@ public class JettySolrRunner {
     root.setHandler(new GzipHandler());
     server.addLifeCycleListener(new LifeCycle.Listener() {
 
+      @Override
       public void lifeCycleStopping(LifeCycle arg0) {
         System.clearProperty("hostPort");
       }
 
+      @Override
       public void lifeCycleStopped(LifeCycle arg0) {}
 
+      @Override
       public void lifeCycleStarting(LifeCycle arg0) {
         synchronized (JettySolrRunner.this) {
           waitOnSolr = true;
@@ -161,6 +227,7 @@ public class JettySolrRunner {
         }
       }
 
+      @Override
       public void lifeCycleStarted(LifeCycle arg0) {
         lastPort = getFirstConnectorPort();
         System.setProperty("hostPort", Integer.toString(lastPort));
@@ -170,12 +237,14 @@ public class JettySolrRunner {
             schemaFilename);
 //        SolrDispatchFilter filter = new SolrDispatchFilter();
 //        FilterHolder fh = new FilterHolder(filter);
+        debugFilter = root.addFilter(DebugFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
         dispatchFilter = root.addFilter(SolrDispatchFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
         if (solrConfigFilename != null) System.clearProperty("solrconfig");
         if (schemaFilename != null) System.clearProperty("schema");
         System.clearProperty("solr.solr.home");
       }
 
+      @Override
       public void lifeCycleFailure(LifeCycle arg0, Throwable arg1) {
         System.clearProperty("hostPort");
       }
@@ -239,24 +308,11 @@ public class JettySolrRunner {
   }
 
   public void stop() throws Exception {
-    // we try and do a bunch of extra stop stuff because
-    // jetty doesn't like to stop if it started
-    // and ended up in a failure state (like when it cannot get the port)
-    if (server.getState().equals(Server.FAILED)) {
-      Connector[] connectors = server.getConnectors();
-      for (Connector connector : connectors) {
-        connector.stop();
-      }
-    }
+
     Filter filter = dispatchFilter.getFilter();
-    ThreadPool threadPool = server.getThreadPool();
-    server.getServer().stop();
+
     server.stop();
-    if (threadPool instanceof QueuedThreadPool) {
-      ((QueuedThreadPool) threadPool).setMaxStopTimeMs(30000);
-      ((QueuedThreadPool) threadPool).stop();
-      ((QueuedThreadPool) threadPool).join();
-    }
+
     //server.destroy();
     if (server.getState().equals(Server.FAILED)) {
       filter.destroy();
@@ -290,6 +346,10 @@ public class JettySolrRunner {
     return lastPort;
   }
 
+  public DebugFilter getDebugFilter() {
+    return (DebugFilter)debugFilter.getFilter();
+  }
+
   // --------------------------------------------------------------
   // --------------------------------------------------------------
 
@@ -338,17 +398,21 @@ class NoLog implements Logger {
     this.name = name == null ? "" : name;
   }
 
+  @Override
   public boolean isDebugEnabled() {
     return debug;
   }
 
+  @Override
   public void setDebugEnabled(boolean enabled) {
     debug = enabled;
   }
 
+  @Override
   public void debug(String msg, Throwable th) {
   }
 
+  @Override
   public Logger getLogger(String name) {
     if ((name == null && this.name == null)
         || (name != null && name.equals(this.name)))

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java Tue Jan  8 03:40:16 2013
@@ -168,6 +168,7 @@ public class DistributedQueue {
     
     public LatchChildWatcher() {}
     
+    @Override
     public void process(WatchedEvent event) {
       LOG.info("Watcher fired on path: " + event.getPath() + " state: "
           + event.getState() + " type " + event.getType());

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java Tue Jan  8 03:40:16 2013
@@ -62,10 +62,11 @@ public  class LeaderElector {
   
   protected SolrZkClient zkClient;
   
-  private ZkCmdExecutor zkCmdExecutor = new ZkCmdExecutor();
+  private ZkCmdExecutor zkCmdExecutor;
   
   public LeaderElector(SolrZkClient zkClient) {
     this.zkClient = zkClient;
+    zkCmdExecutor = new ZkCmdExecutor((int) (zkClient.getZkClientTimeout()/1000.0 + 3000));
   }
   
   /**

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/Overseer.java Tue Jan  8 03:40:16 2013
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.ClusterState;
@@ -49,7 +50,7 @@ import org.slf4j.LoggerFactory;
 public class Overseer {
   public static final String QUEUE_OPERATION = "operation";
 
-  private static final int STATE_UPDATE_DELAY = 500;  // delay between cloud state updates
+  private static final int STATE_UPDATE_DELAY = 1500;  // delay between cloud state updates
 
   private static Logger log = LoggerFactory.getLogger(Overseer.class);
   
@@ -96,7 +97,9 @@ public class Overseer {
                   clusterState = processMessage(clusterState, message, operation);
                   zkClient.setData(ZkStateReader.CLUSTER_STATE,
                       ZkStateReader.toJSON(clusterState), true);
-                  workQueue.remove();
+                  
+                  workQueue.poll();
+                  
                   head = workQueue.peek();
                 }
               }
@@ -132,7 +135,8 @@ public class Overseer {
                 
                 clusterState = processMessage(clusterState, message, operation);
                 workQueue.offer(head);
-                stateUpdateQueue.remove();
+                
+                stateUpdateQueue.poll();
                 head = stateUpdateQueue.peek();
               }
               zkClient.setData(ZkStateReader.CLUSTER_STATE,

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java Tue Jan  8 03:40:16 2013
@@ -25,6 +25,7 @@ import java.util.Set;
 
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
+import org.apache.solr.common.cloud.ClosableThread;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.cloud.Replica;
@@ -35,6 +36,7 @@ import org.apache.solr.common.cloud.ZooK
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction;
 import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.handler.component.ShardHandler;
 import org.apache.solr.handler.component.ShardRequest;
 import org.apache.solr.handler.component.ShardResponse;
@@ -42,7 +44,7 @@ import org.apache.zookeeper.KeeperExcept
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class OverseerCollectionProcessor implements Runnable {
+public class OverseerCollectionProcessor implements Runnable, ClosableThread {
   
   public static final String NUM_SLICES = "numShards";
   
@@ -50,6 +52,8 @@ public class OverseerCollectionProcessor
   
   public static final String MAX_SHARDS_PER_NODE = "maxShardsPerNode";
   
+  public static final String CREATE_NODE_SET = "createNodeSet";
+  
   public static final String DELETECOLLECTION = "deletecollection";
 
   public static final String CREATECOLLECTION = "createcollection";
@@ -77,11 +81,15 @@ public class OverseerCollectionProcessor
   private boolean isClosed;
   
   public OverseerCollectionProcessor(ZkStateReader zkStateReader, String myId, ShardHandler shardHandler, String adminPath) {
+    this(zkStateReader, myId, shardHandler, adminPath, Overseer.getCollectionQueue(zkStateReader.getZkClient()));
+  }
+
+  protected OverseerCollectionProcessor(ZkStateReader zkStateReader, String myId, ShardHandler shardHandler, String adminPath, DistributedQueue workQueue) {
     this.zkStateReader = zkStateReader;
     this.myId = myId;
     this.shardHandler = shardHandler;
     this.adminPath = adminPath;
-    workQueue = Overseer.getCollectionQueue(zkStateReader.getZkClient());
+    this.workQueue = workQueue;
   }
   
   @Override
@@ -109,7 +117,10 @@ public class OverseerCollectionProcessor
                   + " failed", t);
         }
         //}
-        workQueue.remove();
+        
+        
+        workQueue.poll();
+       
       } catch (KeeperException e) {
         if (e.code() == KeeperException.Code.SESSIONEXPIRED
             || e.code() == KeeperException.Code.CONNECTIONLOSS) {
@@ -130,7 +141,7 @@ public class OverseerCollectionProcessor
     isClosed = true;
   }
   
-  private boolean amILeader() {
+  protected boolean amILeader() {
     try {
       ZkNodeProps props = ZkNodeProps.load(zkStateReader.getZkClient().getData(
           "/overseer_elect/leader", null, null, true));
@@ -146,7 +157,7 @@ public class OverseerCollectionProcessor
     return false;
   }
   
-  private boolean processMessage(ZkNodeProps message, String operation) {
+  protected boolean processMessage(ZkNodeProps message, String operation) {
     if (CREATECOLLECTION.equals(operation)) {
       return createCollection(zkStateReader.getClusterState(), message);
     } else if (DELETECOLLECTION.equals(operation)) {
@@ -174,11 +185,13 @@ public class OverseerCollectionProcessor
       // look at the replication factor and see if it matches reality
       // if it does not, find best nodes to create more cores
       
-      int numReplica = msgStrToInt(message, REPLICATION_FACTOR, 0);
+      int repFactor = msgStrToInt(message, REPLICATION_FACTOR, 1);
       int numSlices = msgStrToInt(message, NUM_SLICES, 0);
       int maxShardsPerNode = msgStrToInt(message, MAX_SHARDS_PER_NODE, 1);
+      String createNodeSetStr; 
+      List<String> createNodeList = ((createNodeSetStr = message.getStr(CREATE_NODE_SET)) == null)?null:StrUtils.splitSmart(createNodeSetStr, ",", true);
       
-      if (numReplica < 0) {
+      if (repFactor <= 0) {
         SolrException.log(log, REPLICATION_FACTOR + " must be > 0");
         return false;
       }
@@ -200,20 +213,20 @@ public class OverseerCollectionProcessor
       Set<String> nodes = clusterState.getLiveNodes();
       List<String> nodeList = new ArrayList<String>(nodes.size());
       nodeList.addAll(nodes);
+      if (createNodeList != null) nodeList.retainAll(createNodeList);
       Collections.shuffle(nodeList);
       
       if (nodeList.size() <= 0) {
         log.error("Cannot create collection " + collectionName
-            + ". No live Solr-instaces");
+            + ". No live Solr-instaces" + ((createNodeList != null)?" among Solr-instances specified in " + CREATE_NODE_SET:""));
         return false;
       }
       
-      int numShardsPerSlice = numReplica + 1;
-      if (numShardsPerSlice > nodeList.size()) {
+      if (repFactor > nodeList.size()) {
         log.warn("Specified "
             + REPLICATION_FACTOR
             + " of "
-            + numReplica
+            + repFactor
             + " on collection "
             + collectionName
             + " is higher than or equal to the number of Solr instances currently live ("
@@ -222,21 +235,21 @@ public class OverseerCollectionProcessor
       }
       
       int maxShardsAllowedToCreate = maxShardsPerNode * nodeList.size();
-      int requestedShardsToCreate = numSlices * numShardsPerSlice;
+      int requestedShardsToCreate = numSlices * repFactor;
       if (maxShardsAllowedToCreate < requestedShardsToCreate) {
         log.error("Cannot create collection " + collectionName + ". Value of "
             + MAX_SHARDS_PER_NODE + " is " + maxShardsPerNode
             + ", and the number of live nodes is " + nodeList.size()
             + ". This allows a maximum of " + maxShardsAllowedToCreate
             + " to be created. Value of " + NUM_SLICES + " is " + numSlices
-            + " and value of " + REPLICATION_FACTOR + " is " + numReplica
+            + " and value of " + REPLICATION_FACTOR + " is " + repFactor
             + ". This requires " + requestedShardsToCreate
             + " shards to be created (higher than the allowed number)");
         return false;
       }
       
       for (int i = 1; i <= numSlices; i++) {
-        for (int j = 1; j <= numShardsPerSlice; j++) {
+        for (int j = 1; j <= repFactor; j++) {
           String nodeName = nodeList.get(((i - 1) + (j - 1)) % nodeList.size());
           String sliceName = "shard" + i;
           String shardName = collectionName + "_" + sliceName + "_replica" + j;
@@ -257,9 +270,8 @@ public class OverseerCollectionProcessor
           ShardRequest sreq = new ShardRequest();
           params.set("qt", adminPath);
           sreq.purpose = 1;
-          // TODO: this does not work if original url had _ in it
-          // We should have a master list
-          String replica = nodeName.replaceAll("_", "/");
+          String replica = zkStateReader.getZkClient()
+            .getBaseUrlForNodeName(nodeName);
           if (replica.startsWith("http://")) replica = replica.substring(7);
           sreq.shards = new String[] {replica};
           sreq.actualShards = sreq.shards;
@@ -375,4 +387,9 @@ public class OverseerCollectionProcessor
       throw ex;
     }
   }
+
+  @Override
+  public boolean isClosed() {
+    return isClosed;
+  }
 }

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java Tue Jan  8 03:40:16 2013
@@ -99,6 +99,7 @@ public class RecoveryStrategy extends Th
   }
 
   // make sure any threads stop retrying
+  @Override
   public void close() {
     close = true;
     log.warn("Stopping recovery for zkNodeName=" + coreZkNodeName + "core=" + coreName );
@@ -174,7 +175,7 @@ public class RecoveryStrategy extends Th
   private void commitOnLeader(String leaderUrl) throws SolrServerException, IOException {
     HttpSolrServer server = new HttpSolrServer(leaderUrl);
     server.setConnectionTimeout(30000);
-    server.setSoTimeout(30000);
+    server.setSoTimeout(60000);
     UpdateRequest ureq = new UpdateRequest();
     ureq.setParams(new ModifiableSolrParams());
     ureq.getParams().set(DistributedUpdateProcessor.COMMIT_END_POINT, true);
@@ -189,7 +190,7 @@ public class RecoveryStrategy extends Th
       IOException {
     HttpSolrServer server = new HttpSolrServer(leaderBaseUrl);
     server.setConnectionTimeout(45000);
-    server.setSoTimeout(45000);
+    server.setSoTimeout(120000);
     WaitForState prepCmd = new WaitForState();
     prepCmd.setCoreName(leaderCoreName);
     prepCmd.setNodeName(zkController.getNodeName());
@@ -317,7 +318,7 @@ public class RecoveryStrategy extends Th
       try {
         CloudDescriptor cloudDesc = core.getCoreDescriptor()
             .getCloudDescriptor();
-        ZkNodeProps leaderprops = zkStateReader.getLeaderProps(
+        ZkNodeProps leaderprops = zkStateReader.getLeaderRetry(
             cloudDesc.getCollectionName(), cloudDesc.getShardId());
       
         String leaderBaseUrl = leaderprops.getStr(ZkStateReader.BASE_URL_PROP);
@@ -340,6 +341,18 @@ public class RecoveryStrategy extends Th
         }
         
         zkController.publish(core.getCoreDescriptor(), ZkStateReader.RECOVERING);
+        
+        
+        sendPrepRecoveryCmd(leaderBaseUrl, leaderCoreName);
+        
+        // we wait a bit so that any updates on the leader
+        // that started before they saw recovering state 
+        // are sure to have finished
+        try {
+          Thread.sleep(2000);
+        } catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
 
         // first thing we just try to sync
         if (firstTime) {
@@ -387,17 +400,6 @@ public class RecoveryStrategy extends Th
 
         log.info("Starting Replication Recovery. core=" + coreName);
         
-        sendPrepRecoveryCmd(leaderBaseUrl, leaderCoreName);
-        
-        // we wait a bit so that any updates on the leader
-        // that started before they saw recovering state 
-        // are sure to have finished
-        try {
-          Thread.sleep(2000);
-        } catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-        
         log.info("Begin buffering updates. core=" + coreName);
         ulog.bufferUpdates();
         replayed = false;
@@ -532,6 +534,7 @@ public class RecoveryStrategy extends Th
     return future;
   }
 
+  @Override
   public boolean isClosed() {
     return close;
   }

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java Tue Jan  8 03:40:16 2013
@@ -271,7 +271,11 @@ public class SyncStrategy {
   
   public void close() {
     this.isClosed = true;
-    ExecutorUtil.shutdownNowAndAwaitTermination(recoveryCmdExecutor);
+    try {
+      ExecutorUtil.shutdownNowAndAwaitTermination(recoveryCmdExecutor);
+    } catch (Throwable e) {
+      SolrException.log(log, e);
+    }
   }
   
   private void requestRecovery(final ZkNodeProps leaderProps, final String baseUrl, final String coreName) throws SolrServerException, IOException {

Modified: lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java?rev=1430130&r1=1430129&r2=1430130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java (original)
+++ lucene/dev/branches/lucene4547/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java Tue Jan  8 03:40:16 2013
@@ -123,12 +123,12 @@ public class ZkCLI {
         HelpFormatter formatter = new HelpFormatter();
         formatter.printHelp(ZK_CLI_NAME, options);
         System.out.println("Examples:");
-        System.out.println("zkcli.sh -cmd " + BOOTSTRAP + " -" + SOLRHOME + " /opt/solr");
-        System.out.println("zkcli.sh -cmd " + UPCONFIG + " -" + CONFDIR + " /opt/solr/collection1/conf" + " -" + CONFNAME + " myconf");
-        System.out.println("zkcli.sh -cmd " + DOWNCONFIG + " -" + CONFDIR + " /opt/solr/collection1/conf" + " -" + CONFNAME + " myconf");
-        System.out.println("zkcli.sh -cmd " + LINKCONFIG + " -" + COLLECTION + " collection1" + " -" + CONFNAME + " myconf");
-        System.out.println("zkcli.sh -cmd " + MAKEPATH + " /apache/solr");
-        System.out.println("zkcli.sh -cmd " + CLEAR + " /solr");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + BOOTSTRAP + " -" + SOLRHOME + " /opt/solr");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + UPCONFIG + " -" + CONFDIR + " /opt/solr/collection1/conf" + " -" + CONFNAME + " myconf");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + DOWNCONFIG + " -" + CONFDIR + " /opt/solr/collection1/conf" + " -" + CONFNAME + " myconf");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + LINKCONFIG + " -" + COLLECTION + " collection1" + " -" + CONFNAME + " myconf");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + MAKEPATH + " /apache/solr");
+        System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + CLEAR + " /solr");
         return;
       }
       
@@ -173,6 +173,12 @@ public class ZkCLI {
           InputSource cfgis = new InputSource(new File(solrHome, SOLR_XML)
               .toURI().toASCIIString());
           Config cfg = new Config(loader, null, cfgis, null, false);
+          
+          if(!ZkController.checkChrootPath(zkServerAddress, true)) {
+            System.out.println("A chroot was specified in zkHost but the znode doesn't exist. ");
+            System.exit(1);
+          }
+          
           ZkController.bootstrapConf(zkClient, cfg, solrHome);
           
         } else if (line.getOptionValue(CMD).equals(UPCONFIG)) {
@@ -184,6 +190,11 @@ public class ZkCLI {
           String confDir = line.getOptionValue(CONFDIR);
           String confName = line.getOptionValue(CONFNAME);
           
+          if(!ZkController.checkChrootPath(zkServerAddress, true)) {
+            System.out.println("A chroot was specified in zkHost but the znode doesn't exist. ");
+            System.exit(1);
+          }
+          
           ZkController.uploadConfigDir(zkClient, new File(confDir), confName);
         } else if (line.getOptionValue(CMD).equals(DOWNCONFIG)) {
           if (!line.hasOption(CONFDIR) || !line.hasOption(CONFNAME)) {



Mime
View raw message