lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r890775 - in /lucene/solr/trunk/contrib/dataimporthandler/src: extras/test/java/org/apache/solr/handler/dataimport/ extras/test/resources/solr/conf/ main/java/org/apache/solr/handler/dataimport/ test/java/org/apache/solr/handler/dataimport/...
Date Tue, 15 Dec 2009 12:18:59 GMT
Author: noble
Date: Tue Dec 15 12:18:59 2009
New Revision: 890775

URL: http://svn.apache.org/viewvc?rev=890775&view=rev
Log:
SOLR-1655 . testcases are modified so thatthey explicitly mention MockDataSource

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
    lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml
    lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
Tue Dec 15 12:18:59 2009
@@ -46,9 +46,9 @@
   public void testIndexingWithTikaEntityProcessor() throws Exception {
     String conf =
             "<dataConfig>" +
-                    "  <dataSource name=\"binary\" type=\"BinFileDataSource\"/>" +
+                    "  <dataSource type=\"BinFileDataSource\"/>" +
                     "  <document>" +
-                    "    <entity processor=\"TikaEntityProcessor\" url=\"../../../../../extraction/src/test/resources/solr-word.pdf\"
dataSource=\"binary\">" +
+                    "    <entity processor=\"TikaEntityProcessor\" url=\"../../../../../extraction/src/test/resources/solr-word.pdf\"
>" +
                     "      <field column=\"Author\" meta=\"true\" name=\"author\"/>"
+
                     "      <field column=\"title\" meta=\"true\" name=\"docTitle\"/>"
+
                     "      <field column=\"text\"/>" +

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml
Tue Dec 15 12:18:59 2009
@@ -328,11 +328,6 @@
   </requestHandler>
   
   <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
-    <lst name="defaults">
-      <lst name="datasource">
-         <str name="type">MockDataSource</str>
-      </lst>
-    </lst>
   </requestHandler>
     
   <!--

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
Tue Dec 15 12:18:59 2009
@@ -279,6 +279,12 @@
         dataSources.put(p.getProperty("name"), p);
       }
     }
+    if(dataSources.get(null) == null){
+      for (Properties properties : dataSources.values()) {
+        dataSources.put(null,properties);
+        break;        
+      } 
+    }
   }
 
   private static String getStringAttribute(Element e, String name, String def) {

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
Tue Dec 15 12:18:59 2009
@@ -271,7 +271,6 @@
   }
 
   DataSource getDataSourceInstance(DataConfig.Entity key, String name, Context ctx) {
-    if ("null".equals(name)) return new MockDataSource();
     Properties p = dataSourceProps.get(name);
     if (p == null)
       p = config.dataSources.get(name);
@@ -283,15 +282,15 @@
       throw new DataImportHandlerException(SEVERE,
               "No dataSource :" + name + " available for entity :"
                       + key.name);
-    String impl = p.getProperty(TYPE);
+    String type = p.getProperty(TYPE);
     DataSource dataSrc = null;
-    if (impl == null) {
+    if (type == null) {
       dataSrc = new JdbcDataSource();
     } else {
       try {
-        dataSrc = (DataSource) DocBuilder.loadClass(impl, getCore()).newInstance();
+        dataSrc = (DataSource) DocBuilder.loadClass(type, getCore()).newInstance();
       } catch (Exception e) {
-        wrapAndThrow(SEVERE, e, "Invalid type for data source: " + impl);
+        wrapAndThrow(SEVERE, e, "Invalid type for data source: " + type);
       }
     }
     try {

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDocBuilder2.java
Tue Dec 15 12:18:59 2009
@@ -298,7 +298,7 @@
           "    </document>\n" +
           "</dataConfig>";
 
-   private final String dataConfigWithDynamicTransformer = "<dataConfig>\n" +
+   private final String dataConfigWithDynamicTransformer = "<dataConfig> <dataSource
type=\"MockDataSource\"/>\n" +
           "    <document>\n" +
           "        <entity name=\"books\" query=\"select * from x\"" +
            "                transformer=\"TestDocBuilder2$AddDynamicFieldTransformer\">\n"
+
@@ -308,7 +308,7 @@
           "    </document>\n" +
           "</dataConfig>";
 
-  private final String dataConfigForSkipTransform = "<dataConfig>\n" +
+  private final String dataConfigForSkipTransform = "<dataConfig> <dataSource  type=\"MockDataSource\"/>\n"
+
           "    <document>\n" +
           "        <entity name=\"books\" query=\"select * from x\"" +
            "                transformer=\"TemplateTransformer\">\n" +
@@ -319,7 +319,7 @@
           "    </document>\n" +
           "</dataConfig>";
 
-  private final String dataConfigWithTwoEntities = "<dataConfig>\n" +
+  private final String dataConfigWithTwoEntities = "<dataConfig><dataSource type=\"MockDataSource\"/>\n"
+
           "    <document>\n" +
           "        <entity name=\"books\" query=\"select * from x\">" +
           "            <field column=\"id\" />\n" +
@@ -331,7 +331,7 @@
           "    </document>\n" +
           "</dataConfig>";
 
-  private final String dataConfigWithCaseInsensitiveFields = "<dataConfig>\n" +
+  private final String dataConfigWithCaseInsensitiveFields = "<dataConfig> <dataSource
 type=\"MockDataSource\"/>\n" +
           "    <document onImportStart=\"TestDocBuilder2$StartEventListener\" onImportEnd=\"TestDocBuilder2$EndEventListener\">\n"
+
           "        <entity name=\"books\" query=\"select * from x\">\n" +
           "            <field column=\"ID\" />\n" +
@@ -340,7 +340,7 @@
           "    </document>\n" +
           "</dataConfig>";
 
-  private final String dataConfigWithTemplatizedFieldNames = "<dataConfig>\n" +
+  private final String dataConfigWithTemplatizedFieldNames = "<dataConfig><dataSource
 type=\"MockDataSource\"/>\n" +
           "    <document>\n" +
           "        <entity name=\"books\" query=\"select * from x\">\n" +
           "            <field column=\"mypk\" name=\"${dih.request.mypk}\" />\n" +

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestErrorHandling.java
Tue Dec 15 12:18:59 2009
@@ -133,6 +133,7 @@
 
   private String dataConfigWithTransformer = "<dataConfig>\n" +
           "        <dataSource name=\"str\" type=\"TestErrorHandling$StringDataSource\"
/>" +
+          "<dataSource  type=\"MockDataSource\"/>" +
           "    <document>\n" +
           "        <entity name=\"node\" dataSource=\"str\" processor=\"XPathEntityProcessor\"
url=\"test\" forEach=\"/root/node\">\n" +
           "            <field column=\"id\" xpath=\"/root/node/id\" />\n" +

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessor2.java
Tue Dec 15 12:18:59 2009
@@ -218,14 +218,14 @@
     }
   }
 
-  private static String dataConfig_LastIndexTime = "<dataConfig>\n" +
+  private static String dataConfig_LastIndexTime = "<dataConfig><dataSource  type=\"MockDataSource\"/>\n"
+
           "\t<function name=\"checkDateFormat\" class=\"org.apache.solr.handler.dataimport.TestSqlEntityProcessor2$DateFormatValidatingEvaluator\"/>\n"
+
           "\t<document>\n" +
           "\t\t<entity name=\"x\" query=\"select * from x where last_modified > ${dih.functions.checkDateFormat(dih.last_index_time)}\"
/>\n" +
           "\t</document>\n" +
           "</dataConfig>";
 
-  private static String dataConfig = "<dataConfig>\n"
+  private static String dataConfig = "<dataConfig><dataSource  type=\"MockDataSource\"/>\n"
           + "       <document>\n"
           + "               <entity name=\"x\" pk=\"id\" query=\"select * from x\" deletedPkQuery=\"select
id from x where last_modified > NOW AND deleted='true'\" deltaQuery=\"select id from x
where last_modified > NOW\">\n"
           + "                       <field column=\"id\" />\n"
@@ -234,7 +234,7 @@
           + "                       </entity>\n" + "               </entity>\n"
           + "       </document>\n" + "</dataConfig>\n";
 
-  private static String dataConfig_deltaimportquery = "<dataConfig>\n"
+  private static String dataConfig_deltaimportquery = "<dataConfig><dataSource 
type=\"MockDataSource\"/>\n"
           + "       <document>\n"
           + "               <entity name=\"x\" deltaImportQuery=\"select * from x where
id=${dataimporter.delta.id}\" deltaQuery=\"select id from x where last_modified > NOW\">\n"
           + "                       <field column=\"id\" />\n"

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
Tue Dec 15 12:18:59 2009
@@ -279,7 +279,7 @@
     assertQ(req("desc:goodbye"), "//*[@numFound='1']");
   }
 
-  private static String dataConfig_delta = "<dataConfig>\n"
+  private static String dataConfig_delta = "<dataConfig><dataSource  type=\"MockDataSource\"/>\n"
     + "       <document>\n"
     + "               <entity name=\"x\" transformer=\"TemplateTransformer\""
     + "				query=\"" + FULLIMPORT_QUERY + "\""

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
Tue Dec 15 12:18:59 2009
@@ -275,7 +275,7 @@
     assertQ(req("desc:goodbye"), "//*[@numFound='1']");
   }
 
-  private static String dataConfig_delta2 = "<dataConfig>\n"
+  private static String dataConfig_delta2 = "<dataConfig><dataSource  type=\"MockDataSource\"/>\n"
     + "       <document>\n"
     + "               <entity name=\"x\" transformer=\"TemplateTransformer\""
     + "				query=\"" + FULLIMPORT_QUERY + "\""

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml
Tue Dec 15 12:18:59 2009
@@ -328,11 +328,6 @@
   </requestHandler>
   
   <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
-    <lst name="defaults">
-      <lst name="datasource">
-         <str name="type">MockDataSource</str>
-      </lst>
-    </lst>
   </requestHandler>
     
   <!--

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml?rev=890775&r1=890774&r2=890775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml
Tue Dec 15 12:18:59 2009
@@ -1,4 +1,5 @@
 <dataConfig>
+  <dataSource type="MockDataSource"/>
 	<document>
 		<entity name="x" query="select * from x">
 			<field column="id" />



Mime
View raw message