You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2014/02/20 09:57:53 UTC

svn commit: r1570113 [2/2] - in /lucene/dev/branches/solr4470: ./ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ lucene/analysis/common/src/test/org/apache/lucene/analysis/core/ luc...

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-cell/src/test/org/apache/solr/morphlines/cell/SolrCellMorphlineTest.java Thu Feb 20 08:57:51 2014
@@ -1,4 +1,4 @@
-/**
+/*
  * 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.
@@ -50,23 +50,23 @@ public class SolrCellMorphlineTest exten
   public void setUp() throws Exception {
     super.setUp();
     
-    String path = RESOURCES_DIR + "/test-documents";
-    expectedRecords.put(path + "/sample-statuses-20120906-141433.avro", 2);
-    expectedRecords.put(path + "/sample-statuses-20120906-141433", 2);
-    expectedRecords.put(path + "/sample-statuses-20120906-141433.gz", 2);
-    expectedRecords.put(path + "/sample-statuses-20120906-141433.bz2", 2);
-    expectedRecords.put(path + "/cars.csv", 6);
-    expectedRecords.put(path + "/cars.csv.gz", 6);
-    expectedRecords.put(path + "/cars.tar.gz", 4);
-    expectedRecords.put(path + "/cars.tsv", 6);
-    expectedRecords.put(path + "/cars.ssv", 6);
-    expectedRecords.put(path + "/test-documents.7z", 9);
-    expectedRecords.put(path + "/test-documents.cpio", 9);
-    expectedRecords.put(path + "/test-documents.tar", 9);
-    expectedRecords.put(path + "/test-documents.tbz2", 9);
-    expectedRecords.put(path + "/test-documents.tgz", 9);
-    expectedRecords.put(path + "/test-documents.zip", 9);
-    expectedRecords.put(path + "/multiline-stacktrace.log", 4);
+    String path = RESOURCES_DIR + File.separator + "test-documents" + File.separator;
+    expectedRecords.put(path + "sample-statuses-20120906-141433.avro", 2);
+    expectedRecords.put(path + "sample-statuses-20120906-141433", 2);
+    expectedRecords.put(path + "sample-statuses-20120906-141433.gz", 2);
+    expectedRecords.put(path + "sample-statuses-20120906-141433.bz2", 2);
+    expectedRecords.put(path + "cars.csv", 6);
+    expectedRecords.put(path + "cars.csv.gz", 6);
+    expectedRecords.put(path + "cars.tar.gz", 4);
+    expectedRecords.put(path + "cars.tsv", 6);
+    expectedRecords.put(path + "cars.ssv", 6);
+    expectedRecords.put(path + "test-documents.7z", 9);
+    expectedRecords.put(path + "test-documents.cpio", 9);
+    expectedRecords.put(path + "test-documents.tar", 9);
+    expectedRecords.put(path + "test-documents.tbz2", 9);
+    expectedRecords.put(path + "test-documents.tgz", 9);
+    expectedRecords.put(path + "test-documents.zip", 9);
+    expectedRecords.put(path + "multiline-stacktrace.log", 4);
     
     {
       Map<String, Object> record = new LinkedHashMap();
@@ -81,7 +81,7 @@ public class SolrCellMorphlineTest exten
     }
     
     {
-      String file = path + "/testWORD_various.doc";
+      String file = path + "testWORD_various.doc";
       Map<String, Object> record = new LinkedHashMap();
       record.put("ignored__attachment_mimetype", "application/msword");
       record.put("ignored_author", "Michael McCandless");
@@ -94,7 +94,7 @@ public class SolrCellMorphlineTest exten
     }
     
     {
-      String file = path + "/testPDF.pdf";
+      String file = path + "testPDF.pdf";
       Map<String, Object> record = new LinkedHashMap();
       record.put("ignored__attachment_mimetype", "application/pdf");
       record.put("ignored_author", "Bertrand Delacrétaz");
@@ -106,7 +106,7 @@ public class SolrCellMorphlineTest exten
     }
     
     {
-      String file = path + "/email.eml";
+      String file = path + "email.eml";
       Map<String, Object> record = new LinkedHashMap();
       String name = "Patrick Foo <fo...@cloudera.com>";
       record.put("ignored__attachment_mimetype", "message/rfc822");
@@ -127,7 +127,7 @@ public class SolrCellMorphlineTest exten
     }
 
     {
-      String file = path + "/testEXCEL.xlsx";
+      String file = path + "testEXCEL.xlsx";
       Map<String, Object> record = new LinkedHashMap();
       record.put("ignored__attachment_mimetype", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
       record.put("ignored_author", "Keith Bennett");
@@ -142,23 +142,23 @@ public class SolrCellMorphlineTest exten
   
   @Test
   public void testSolrCellJPGCompressed() throws Exception {
-    morphline = createMorphline("test-morphlines/solrCellJPGCompressed");    
-    String path = RESOURCES_DIR + "/test-documents";
+    morphline = createMorphline("test-morphlines" + File.separator + "solrCellJPGCompressed");    
+    String path = RESOURCES_DIR + File.separator + "test-documents" + File.separator;
     String[] files = new String[] {
-        path + "/testJPEG_EXIF.jpg",
-        path + "/testJPEG_EXIF.jpg.gz",
-        path + "/testJPEG_EXIF.jpg.tar.gz",
-        //path + "/jpeg2000.jp2",
+        path + "testJPEG_EXIF.jpg",
+        path + "testJPEG_EXIF.jpg.gz",
+        path + "testJPEG_EXIF.jpg.tar.gz",
+        //path + "jpeg2000.jp2",
     };
     testDocumentTypesInternal(files, expectedRecords, expectedRecordContents);
   }  
 
   @Test
   public void testSolrCellXML() throws Exception {
-    morphline = createMorphline("test-morphlines/solrCellXML");    
-    String path = RESOURCES_DIR + "/test-documents";
+    morphline = createMorphline("test-morphlines" + File.separator + "solrCellXML");    
+    String path = RESOURCES_DIR + File.separator + "test-documents" + File.separator;
     String[] files = new String[] {
-        path + "/testXML2.xml",
+        path + "testXML2.xml",
     };
     testDocumentTypesInternal(files, expectedRecords, expectedRecordContents);
   }  
@@ -168,27 +168,27 @@ public class SolrCellMorphlineTest exten
     AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", false);
     
     morphline = createMorphline(new File(tempDir).getAbsolutePath() +  "/test-morphlines/solrCellDocumentTypes");    
-    String path = RESOURCES_DIR + "/test-documents";
+    String path = RESOURCES_DIR + File.separator + "test-documents" + File.separator;
     String[] files = new String[] {
-        path + "/testBMPfp.txt",
-        path + "/boilerplate.html",
-        path + "/NullHeader.docx",
-        path + "/testWORD_various.doc",          
-        path + "/testPDF.pdf",
-        path + "/testJPEG_EXIF.jpg",
-        path + "/testJPEG_EXIF.jpg.gz",
-        path + "/testJPEG_EXIF.jpg.tar.gz",
-        path + "/testXML.xml",          
-        path + "/cars.csv",
-//        path + "/cars.tsv",
-//        path + "/cars.ssv",
-        path + "/cars.csv.gz",
-        path + "/cars.tar.gz",
-        path + "/sample-statuses-20120906-141433.avro",
-        path + "/sample-statuses-20120906-141433",
-        path + "/sample-statuses-20120906-141433.gz",
-        path + "/sample-statuses-20120906-141433.bz2",
-        path + "/email.eml",
+        path + "testBMPfp.txt",
+        path + "boilerplate.html",
+        path + "NullHeader.docx",
+        path + "testWORD_various.doc",          
+        path + "testPDF.pdf",
+        path + "testJPEG_EXIF.jpg",
+        path + "testJPEG_EXIF.jpg.gz",
+        path + "testJPEG_EXIF.jpg.tar.gz",
+        path + "testXML.xml",          
+        path + "cars.csv",
+//        path + "cars.tsv",
+//        path + "cars.ssv",
+        path + "cars.csv.gz",
+        path + "cars.tar.gz",
+        path + "sample-statuses-20120906-141433.avro",
+        path + "sample-statuses-20120906-141433",
+        path + "sample-statuses-20120906-141433.gz",
+        path + "sample-statuses-20120906-141433.bz2",
+        path + "email.eml",
     };
     testDocumentTypesInternal(files, expectedRecords, expectedRecordContents);
   }
@@ -199,58 +199,58 @@ public class SolrCellMorphlineTest exten
     AbstractSolrMorphlineTestBase.setupMorphline(tempDir, "test-morphlines/solrCellDocumentTypes", false);
     
     morphline = createMorphline(new File(tempDir).getAbsolutePath() + "/test-morphlines/solrCellDocumentTypes");    
-    String path = RESOURCES_DIR + "/test-documents";
+    String path = RESOURCES_DIR + File.separator + "test-documents" + File.separator;
     String[] files = new String[] {
-        path + "/testPPT_various.ppt",
-        path + "/testPPT_various.pptx",        
-        path + "/testEXCEL.xlsx",
-        path + "/testEXCEL.xls", 
-        path + "/testPages.pages", 
-        //path + "/testNumbers.numbers", 
-        //path + "/testKeynote.key",
+        path + "testPPT_various.ppt",
+        path + "testPPT_various.pptx",        
+        path + "testEXCEL.xlsx",
+        path + "testEXCEL.xls", 
+        path + "testPages.pages", 
+        //path + "testNumbers.numbers", 
+        //path + "testKeynote.key",
         
-        path + "/testRTFVarious.rtf", 
-        path + "/complex.mbox", 
-        path + "/test-outlook.msg", 
-        path + "/testEMLX.emlx",
-        path + "/testRFC822",  
-        path + "/rsstest.rss", 
-//        path + "/testDITA.dita", 
+        path + "testRTFVarious.rtf", 
+        path + "complex.mbox", 
+        path + "test-outlook.msg", 
+        path + "testEMLX.emlx",
+        path + "testRFC822",  
+        path + "rsstest.rss", 
+//        path + "testDITA.dita", 
         
-        path + "/testMP3i18n.mp3", 
-        path + "/testAIFF.aif", 
-        path + "/testFLAC.flac", 
-//        path + "/testFLAC.oga", 
-//        path + "/testVORBIS.ogg",  
-        path + "/testMP4.m4a", 
-        path + "/testWAV.wav", 
-//        path + "/testWMA.wma", 
+        path + "testMP3i18n.mp3", 
+        path + "testAIFF.aif", 
+        path + "testFLAC.flac", 
+//        path + "testFLAC.oga", 
+//        path + "testVORBIS.ogg",  
+        path + "testMP4.m4a", 
+        path + "testWAV.wav", 
+//        path + "testWMA.wma", 
         
-        path + "/testFLV.flv", 
-//        path + "/testWMV.wmv", 
+        path + "testFLV.flv", 
+//        path + "testWMV.wmv", 
         
-        path + "/testBMP.bmp", 
-        path + "/testPNG.png", 
-        path + "/testPSD.psd",        
-        path + "/testSVG.svg",  
-        path + "/testTIFF.tif",     
-
-//        path + "/test-documents.7z", 
-//        path + "/test-documents.cpio",
-//        path + "/test-documents.tar", 
-//        path + "/test-documents.tbz2", 
-//        path + "/test-documents.tgz",
-//        path + "/test-documents.zip",
-//        path + "/test-zip-of-zip.zip",
-//        path + "/testJAR.jar",
+        path + "testBMP.bmp", 
+        path + "testPNG.png", 
+        path + "testPSD.psd",        
+        path + "testSVG.svg",  
+        path + "testTIFF.tif",     
+
+//        path + "test-documents.7z", 
+//        path + "test-documents.cpio",
+//        path + "test-documents.tar", 
+//        path + "test-documents.tbz2", 
+//        path + "test-documents.tgz",
+//        path + "test-documents.zip",
+//        path + "test-zip-of-zip.zip",
+//        path + "testJAR.jar",
         
-//        path + "/testKML.kml", 
-//        path + "/testRDF.rdf", 
-        path + "/testVISIO.vsd",
-//        path + "/testWAR.war", 
-//        path + "/testWindows-x86-32.exe",
-//        path + "/testWINMAIL.dat", 
-//        path + "/testWMF.wmf", 
+//        path + "testKML.kml", 
+//        path + "testRDF.rdf", 
+        path + "testVISIO.vsd",
+//        path + "testWAR.war", 
+//        path + "testWindows-x86-32.exe",
+//        path + "testWINMAIL.dat", 
+//        path + "testWMF.wmf", 
     };   
     testDocumentTypesInternal(files, expectedRecords, expectedRecordContents);
   }

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java Thu Feb 20 08:57:51 2014
@@ -16,16 +16,10 @@
  */
 package org.apache.solr.morphlines.solr;
 
-import org.kitesdk.morphline.api.MorphlineCompilationException;
-import org.kitesdk.morphline.api.MorphlineContext;
-import org.kitesdk.morphline.api.MorphlineRuntimeException;
-import org.kitesdk.morphline.base.Configs;
+import java.io.File;
+import java.io.IOException;
 
-import com.google.common.base.Preconditions;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import com.typesafe.config.ConfigRenderOptions;
-import com.typesafe.config.ConfigUtil;
+import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.impl.CloudSolrServer;
@@ -35,16 +29,21 @@ import org.apache.solr.core.SolrResource
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.util.SystemIdResolver;
 import org.apache.zookeeper.KeeperException;
+import org.kitesdk.morphline.api.MorphlineCompilationException;
+import org.kitesdk.morphline.api.MorphlineContext;
+import org.kitesdk.morphline.api.MorphlineRuntimeException;
+import org.kitesdk.morphline.base.Configs;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import javax.xml.parsers.ParserConfigurationException;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
+import com.google.common.base.Preconditions;
+import com.google.common.io.Files;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigRenderOptions;
+import com.typesafe.config.ConfigUtil;
 
 /**
  * Set of configuration parameters that identify the location and schema of a Solr server or
@@ -119,55 +118,67 @@ public class SolrLocator {
         return schema;
       }
     }
-    
-    // If solrHomeDir isn't defined and zkHost and collectionName are defined 
-    // then download schema.xml and solrconfig.xml, etc from zk and use that as solrHomeDir
-    String mySolrHomeDir = solrHomeDir;
-    if (solrHomeDir == null || solrHomeDir.length() == 0) {
-      if (zkHost == null || zkHost.length() == 0) {
-        // TODO: implement download from solrUrl if specified
-        throw new MorphlineCompilationException(
-            "Downloading a Solr schema requires either parameter 'solrHomeDir' or parameters 'zkHost' and 'collection'",
-            config);
-      }
-      if (collectionName == null || collectionName.length() == 0) {
-        throw new MorphlineCompilationException(
-            "Parameter 'zkHost' requires that you also pass parameter 'collection'", config);
+
+    File downloadedSolrHomeDir = null;
+    try {
+      // If solrHomeDir isn't defined and zkHost and collectionName are defined 
+      // then download schema.xml and solrconfig.xml, etc from zk and use that as solrHomeDir
+      String mySolrHomeDir = solrHomeDir;
+      if (solrHomeDir == null || solrHomeDir.length() == 0) {
+        if (zkHost == null || zkHost.length() == 0) {
+          // TODO: implement download from solrUrl if specified
+          throw new MorphlineCompilationException(
+              "Downloading a Solr schema requires either parameter 'solrHomeDir' or parameters 'zkHost' and 'collection'",
+              config);
+        }
+        if (collectionName == null || collectionName.length() == 0) {
+          throw new MorphlineCompilationException(
+              "Parameter 'zkHost' requires that you also pass parameter 'collection'", config);
+        }
+        ZooKeeperDownloader zki = new ZooKeeperDownloader();
+        SolrZkClient zkClient = zki.getZkClient(zkHost);
+        try {
+          String configName = zki.readConfigName(zkClient, collectionName);
+          downloadedSolrHomeDir = Files.createTempDir();
+          downloadedSolrHomeDir = zki.downloadConfigDir(zkClient, configName, downloadedSolrHomeDir);
+          mySolrHomeDir = downloadedSolrHomeDir.getAbsolutePath();
+        } catch (KeeperException e) {
+          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
+        } catch (InterruptedException e) {
+          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
+        } catch (IOException e) {
+          throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
+        } finally {
+          zkClient.close();
+        }
       }
-      ZooKeeperDownloader zki = new ZooKeeperDownloader();
-      SolrZkClient zkClient = zki.getZkClient(zkHost);
+      
+      LOG.debug("SolrLocator loading IndexSchema from dir {}", mySolrHomeDir);
       try {
-        String configName = zki.readConfigName(zkClient, collectionName);
-        File downloadedSolrHomeDir = zki.downloadConfigDir(zkClient, configName);
-        mySolrHomeDir = downloadedSolrHomeDir.getAbsolutePath();
-      } catch (KeeperException e) {
-        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
-      } catch (InterruptedException e) {
-        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
+        SolrResourceLoader loader = new SolrResourceLoader(mySolrHomeDir);
+        SolrConfig solrConfig = new SolrConfig(loader, "solrconfig.xml", null);
+        InputSource is = new InputSource(loader.openSchema("schema.xml"));
+        is.setSystemId(SystemIdResolver.createSystemIdFromResourceName("schema.xml"));
+        
+        IndexSchema schema = new IndexSchema(solrConfig, "schema.xml", is);
+        validateSchema(schema);
+        return schema;
+      } catch (ParserConfigurationException e) {
+        throw new MorphlineRuntimeException(e);
       } catch (IOException e) {
-        throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);
-      } finally {
-        zkClient.close();
+        throw new MorphlineRuntimeException(e);
+      } catch (SAXException e) {
+        throw new MorphlineRuntimeException(e);
+      }
+    } finally {
+      if (downloadedSolrHomeDir != null) {
+        try {
+          FileUtils.deleteDirectory(downloadedSolrHomeDir);
+        } catch (IOException e) {
+          LOG.warn("Cannot delete tmp directory", e);
+        }
       }
     }
-    
-    LOG.debug("SolrLocator loading IndexSchema from dir {}", mySolrHomeDir);
-    try {
-      SolrResourceLoader loader = new SolrResourceLoader(mySolrHomeDir);
-      SolrConfig solrConfig = new SolrConfig(loader, "solrconfig.xml", null);
-      InputSource is = new InputSource(loader.openSchema("schema.xml"));
-      is.setSystemId(SystemIdResolver.createSystemIdFromResourceName("schema.xml"));
-      
-      IndexSchema schema = new IndexSchema(solrConfig, "schema.xml", is);
-      validateSchema(schema);
-      return schema;
-    } catch (ParserConfigurationException e) {
-      throw new MorphlineRuntimeException(e);
-    } catch (IOException e) {
-      throw new MorphlineRuntimeException(e);
-    } catch (SAXException e) {
-      throw new MorphlineRuntimeException(e);
-    }
   }
   
   private void validateSchema(IndexSchema schema) {

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/ZooKeeperDownloader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/ZooKeeperDownloader.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/ZooKeeperDownloader.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/ZooKeeperDownloader.java Thu Feb 20 08:57:51 2014
@@ -31,6 +31,7 @@ import org.apache.zookeeper.KeeperExcept
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Preconditions;
 import com.google.common.io.Files;
 
 /**
@@ -100,10 +101,10 @@ final class ZooKeeperDownloader {
   /**
    * Download and return the config directory from ZK
    */
-  public File downloadConfigDir(SolrZkClient zkClient, String configName)
+  public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir)
   throws IOException, InterruptedException, KeeperException {
-    File dir = Files.createTempDir();
-    dir.deleteOnExit();
+    Preconditions.checkArgument(dir.exists());
+    Preconditions.checkArgument(dir.isDirectory());
     ZkController.downloadConfigDir(zkClient, configName, dir);
     File confDir = new File(dir, "conf");
     if (!confDir.isDirectory()) {
@@ -116,7 +117,23 @@ final class ZooKeeperDownloader {
       Files.move(dir, confDir);
       dir = confDir.getParentFile();
     }
+    verifyConfigDir(confDir);
     return dir;
   }
+  
+  private void verifyConfigDir(File confDir) throws IOException {
+    File solrConfigFile = new File(confDir, "solrconfig.xml");
+    if (!solrConfigFile.exists()) {
+      throw new IOException("Detected invalid Solr config dir in ZooKeeper - Reason: File not found: "
+          + solrConfigFile.getName());
+    }
+    if (!solrConfigFile.isFile()) {
+      throw new IOException("Detected invalid Solr config dir in ZooKeeper - Reason: Not a file: "
+          + solrConfigFile.getName());
+    }
+    if (!solrConfigFile.canRead()) {
+      throw new IOException("Insufficient permissions to read file: " + solrConfigFile);
+    }    
+  }
 
 }

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java Thu Feb 20 08:57:51 2014
@@ -54,6 +54,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.codahale.metrics.MetricRegistry;
+import com.google.common.base.Joiner;
 import com.google.common.io.Files;
 import com.typesafe.config.Config;
 
@@ -85,10 +86,11 @@ public class AbstractSolrMorphlineTestBa
   }
 
   protected static void myInitCore(String baseDirName) throws Exception {
+    Joiner joiner = Joiner.on(File.separator);
     initCore(
-        RESOURCES_DIR + "/" + baseDirName + "/collection1/conf/solrconfig.xml",
-        RESOURCES_DIR + "/" + baseDirName + "/collection1/conf/schema.xml",
-        RESOURCES_DIR + "/" + baseDirName
+        joiner.join(RESOURCES_DIR, baseDirName, "collection1", "conf", "solrconfig.xml"),
+        joiner.join(RESOURCES_DIR, baseDirName, "collection1", "conf", "schema.xml"),
+        joiner.join(RESOURCES_DIR, baseDirName)
         );    
   }
   

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineZkTestBase.java Thu Feb 20 08:57:51 2014
@@ -42,6 +42,7 @@ import org.kitesdk.morphline.base.Compil
 import org.kitesdk.morphline.base.FaultTolerance;
 import org.kitesdk.morphline.base.Notifications;
 import org.kitesdk.morphline.stdlib.PipeBuilder;
+
 import com.codahale.metrics.MetricRegistry;
 import com.google.common.collect.ListMultimap;
 import com.typesafe.config.Config;

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineTest.java Thu Feb 20 08:57:51 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.morphlines.solr;
 
+import java.io.File;
 import java.util.Arrays;
 
 import org.apache.lucene.util.Constants;
@@ -57,7 +58,7 @@ public class SolrMorphlineTest extends A
     
   @Test
   public void testTokenizeText() throws Exception {
-    morphline = createMorphline("test-morphlines/tokenizeText");
+    morphline = createMorphline("test-morphlines" + File.separator + "tokenizeText");
     for (int i = 0; i < 3; i++) {
       Record record = new Record();
       record.put(Fields.MESSAGE, "Hello World!");

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java Thu Feb 20 08:57:51 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.morphlines.solr;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 
@@ -31,6 +32,9 @@ import org.apache.solr.common.params.Col
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.junit.BeforeClass;
+import org.kitesdk.morphline.api.Record;
+import org.kitesdk.morphline.base.Fields;
+import org.kitesdk.morphline.base.Notifications;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action;
@@ -39,9 +43,6 @@ import com.carrotsearch.randomizedtestin
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence;
-import org.kitesdk.morphline.api.Record;
-import org.kitesdk.morphline.base.Fields;
-import org.kitesdk.morphline.base.Notifications;
 
 @ThreadLeakAction({Action.WARN})
 @ThreadLeakLingering(linger = 0)
@@ -64,7 +65,7 @@ public class SolrMorphlineZkAliasTest ex
     
     createAlias("aliascollection", "collection1");
     
-    morphline = parse("test-morphlines/loadSolrBasic", "aliascollection");
+    morphline = parse("test-morphlines" + File.separator + "loadSolrBasic", "aliascollection");
     Record record = new Record();
     record.put(Fields.ID, "id0-innsbruck");
     record.put("text", "mytext");
@@ -113,7 +114,7 @@ public class SolrMorphlineZkAliasTest ex
     createAlias("aliascollection", "collection1,collection2");
     
     try {
-      parse("test-morphlines/loadSolrBasic", "aliascollection");
+      parse("test-morphlines" + File.separator + "loadSolrBasic", "aliascollection");
       fail("Expected IAE because update alias maps to multiple collections");
     } catch (IllegalArgumentException e) {
       

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAvroTest.java Thu Feb 20 08:57:51 2014
@@ -35,6 +35,9 @@ import org.apache.solr.client.solrj.Solr
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocument;
 import org.junit.BeforeClass;
+import org.kitesdk.morphline.api.Record;
+import org.kitesdk.morphline.base.Fields;
+import org.kitesdk.morphline.base.Notifications;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action;
@@ -43,9 +46,7 @@ import com.carrotsearch.randomizedtestin
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence;
-import org.kitesdk.morphline.api.Record;
-import org.kitesdk.morphline.base.Fields;
-import org.kitesdk.morphline.base.Notifications;
+import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.io.Files;
 
@@ -65,12 +66,13 @@ public class SolrMorphlineZkAvroTest ext
   
   @Override
   public void doTest() throws Exception {
-    File file = new File(RESOURCES_DIR + "/test-documents/sample-statuses-20120906-141433-medium.avro");
+    Joiner joiner = Joiner.on(File.separator);
+    File file = new File(joiner.join(RESOURCES_DIR, "test-documents", "sample-statuses-20120906-141433-medium.avro"));
     
     waitForRecoveriesToFinish(false);
     
     // load avro records via morphline and zk into solr
-    morphline = parse("test-morphlines/tutorialReadAvroContainer");    
+    morphline = parse("test-morphlines" + File.separator + "tutorialReadAvroContainer");    
     Record record = new Record();
     byte[] body = Files.toByteArray(file);    
     record.put(Fields.ATTACHMENT_BODY, body);

Modified: lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java (original)
+++ lucene/dev/branches/solr4470/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkTest.java Thu Feb 20 08:57:51 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.morphlines.solr;
 
+import java.io.File;
 import java.util.Iterator;
 
 import org.apache.lucene.util.Constants;
@@ -25,6 +26,9 @@ import org.apache.solr.client.solrj.Solr
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocument;
 import org.junit.BeforeClass;
+import org.kitesdk.morphline.api.Record;
+import org.kitesdk.morphline.base.Fields;
+import org.kitesdk.morphline.base.Notifications;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action;
@@ -33,9 +37,6 @@ import com.carrotsearch.randomizedtestin
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies;
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence;
-import org.kitesdk.morphline.api.Record;
-import org.kitesdk.morphline.base.Fields;
-import org.kitesdk.morphline.base.Notifications;
 
 @ThreadLeakAction({Action.WARN})
 @ThreadLeakLingering(linger = 0)
@@ -56,7 +57,7 @@ public class SolrMorphlineZkTest extends
     
     waitForRecoveriesToFinish(false);
     
-    morphline = parse("test-morphlines/loadSolrBasic");    
+    morphline = parse("test-morphlines" + File.separator + "loadSolrBasic");    
     Record record = new Record();
     record.put(Fields.ID, "id0-innsbruck");
     record.put("text", "mytext");

Modified: lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java (original)
+++ lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java Thu Feb 20 08:57:51 2014
@@ -406,7 +406,7 @@ public class BasicDistributedZk2Test ext
     // make sure we have published we are recovering
     Thread.sleep(1500);
     
-    waitForThingsToLevelOut(30);
+    waitForThingsToLevelOut(45);
     
     Thread.sleep(500);
     

Modified: lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java Thu Feb 20 08:57:51 2014
@@ -383,7 +383,7 @@ public class CollectionsAPIDistributedZk
     
     // wait for leaders to settle out
     for (int i = 1; i < 4; i++) {
-      cloudClient.getZkStateReader().getLeaderRetry("halfdeletedcollection2", "shard" + i, 15000);
+      cloudClient.getZkStateReader().getLeaderRetry("halfdeletedcollection2", "shard" + i, 30000);
     }
     
     baseUrl = getBaseUrl((HttpSolrServer) clients.get(2));

Modified: lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java (original)
+++ lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java Thu Feb 20 08:57:51 2014
@@ -355,7 +355,7 @@ public class OverseerTest extends SolrTe
         if (coreCount == assignedCount) {
           break;
         }
-        Thread.sleep(500);
+        Thread.sleep(1000);
       }
       assertEquals("Unable to verify all cores have been returned an id", 
                    coreCount, assignedCount);

Modified: lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java (original)
+++ lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java Thu Feb 20 08:57:51 2014
@@ -240,7 +240,7 @@ public class SyncSliceTest extends Abstr
   }
 
   private void waitTillRecovered() throws Exception {
-    for (int i = 0; i < 45; i++) { 
+    for (int i = 0; i < 60; i++) { 
       Thread.sleep(3000);
       ZkStateReader zkStateReader = cloudClient.getZkStateReader();
       zkStateReader.updateClusterState(true);

Modified: lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java (original)
+++ lucene/dev/branches/solr4470/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java Thu Feb 20 08:57:51 2014
@@ -268,8 +268,8 @@ public class UnloadDistributedZkTest ext
     zkStateReader.getLeaderRetry("unloadcollection", "shard1", 15000);
     
     addClient = new HttpSolrServer(url2 + "/unloadcollection2");
-    addClient.setConnectionTimeout(15000);
-    addClient.setSoTimeout(30000);
+    addClient.setConnectionTimeout(30000);
+    addClient.setSoTimeout(90000);
     
     // add a few docs while the leader is down
     for (int x = 101; x < 200; x++) {

Modified: lucene/dev/branches/solr4470/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java (original)
+++ lucene/dev/branches/solr4470/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java Thu Feb 20 08:57:51 2014
@@ -141,26 +141,6 @@ public class BasicHttpSolrServerTest ext
         .addServletWithMapping(DebugServlet.class, "/debug/*");
   }
   
-  // what is this actually testing? this test WILL randomly fail.
-  // not a good unit test!
-  @Test
-  public void testConnectionRefused() throws MalformedURLException {
-    int unusedPort = findUnusedPort(); // XXX even if fwe found an unused port
-                                       // it might not be unused anymore
-    HttpSolrServer server = new HttpSolrServer(buildUrl(unusedPort, "/solr"));
-    server.setConnectionTimeout(500);
-    SolrQuery q = new SolrQuery("*:*");
-    try {
-      QueryResponse response = server.query(q);
-      fail("Should have thrown an exception.");
-    } catch (SolrServerException e) {
-      assumeFalse("blackholed!", e.getMessage().contains("IOException occured when talking to server"));
-      assertTrue(e.getMessage().contains("refused"));
-    } finally {
-      server.shutdown();
-    }
-  }
-  
   @Test
   public void testTimeout() throws Exception {
     HttpSolrServer server = new HttpSolrServer(jetty.getBaseUrl().toString() +

Modified: lucene/dev/branches/solr4470/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr4470/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1570113&r1=1570112&r2=1570113&view=diff
==============================================================================
--- lucene/dev/branches/solr4470/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/solr4470/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Thu Feb 20 08:57:51 2014
@@ -112,7 +112,7 @@ import com.carrotsearch.randomizedtestin
 })
 public abstract class SolrTestCaseJ4 extends LuceneTestCase {
   private static String coreName = ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME;
-  public static int DEFAULT_CONNECTION_TIMEOUT = 45000;  // default socket connection timeout in ms
+  public static int DEFAULT_CONNECTION_TIMEOUT = 60000;  // default socket connection timeout in ms
 
   // these are meant to be accessed sequentially, but are volatile just to ensure any test
   // thread will read the latest value