gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [1/4] gora git commit: GORA-477 Add support for Solr 5.x
Date Mon, 23 May 2016 15:43:26 GMT
Repository: gora
Updated Branches:
  refs/heads/master f5a6d842d -> 9361023d6


http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/gora-solr-5/src/test/conf/solr/solr.xml
----------------------------------------------------------------------
diff --git a/gora-solr-5/src/test/conf/solr/solr.xml b/gora-solr-5/src/test/conf/solr/solr.xml
new file mode 100644
index 0000000..be78e1f
--- /dev/null
+++ b/gora-solr-5/src/test/conf/solr/solr.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+   This is an example of a simple "solr.xml" file for configuring one or 
+   more Solr Cores, as well as allowing Cores to be added, removed, and 
+   reloaded via HTTP requests.
+
+   More information about options available in this configuration file, 
+   and Solr Core administration can be found online:
+   http://wiki.apache.org/solr/CoreAdmin
+-->
+
+<!--
+ All (relative) paths are relative to the Solr Home Directory
+
+  persistent: Save changes made via the API to this file
+  sharedLib: path to a lib directory that will be shared across all cores
+-->
+<solr>
+  <!-- by default, this is 50 @ WARN
+  <logging enabled="true">
+        <watcher size="100" threshold="DEBUG" />
+  </logging>
+   -->
+
+  <!--
+  adminPath: RequestHandler path to manage cores.
+    If 'null' (or absent), cores will not be manageable via request handler
+  defaultCoreName: (optional) core to use when no core name is specified in an access url
+
+  All of the attributes in cores after defaultCoreName only apply when running in SolrCloud
mode.
+  You can read more about SolrCloud mode at http://wiki.apache.org/solr/SolrCloud
+  -->
+  <solrcloud>
+
+    <str name="host">${host:}</str>
+    <int name="hostPort">${jetty.port:8983}</int>
+    <str name="hostContext">${hostContext:solr}</str>
+
+    <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
+
+    <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
+    <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int>
+    <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int>
+
+  </solrcloud>
+
+  <shardHandlerFactory name="shardHandlerFactory"
+    class="HttpShardHandlerFactory">
+    <int name="socketTimeout">${socketTimeout:600000}</int>
+    <int name="connTimeout">${connTimeout:60000}</int>
+  </shardHandlerFactory>
+</solr>

http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/gora-solr-5/src/test/conf/solr/zoo.cfg
----------------------------------------------------------------------
diff --git a/gora-solr-5/src/test/conf/solr/zoo.cfg b/gora-solr-5/src/test/conf/solr/zoo.cfg
new file mode 100644
index 0000000..863fd19
--- /dev/null
+++ b/gora-solr-5/src/test/conf/solr/zoo.cfg
@@ -0,0 +1,17 @@
+# The number of milliseconds of each tick
+tickTime=2000
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=10
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=5
+
+# the directory where the snapshot is stored.
+# dataDir=/opt/zookeeper/data
+# NOTE: Solr defaults the dataDir to <solrHome>/zoo_data
+
+# the port at which the clients will connect
+# clientPort=2181
+# NOTE: Solr sets this based on zkRun / zkHost params
+

http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/gora-solr-5/src/test/java/org/apache/gora/solr/GoraSolrTestDriver.java
----------------------------------------------------------------------
diff --git a/gora-solr-5/src/test/java/org/apache/gora/solr/GoraSolrTestDriver.java b/gora-solr-5/src/test/java/org/apache/gora/solr/GoraSolrTestDriver.java
new file mode 100644
index 0000000..0fecaf5
--- /dev/null
+++ b/gora-solr-5/src/test/java/org/apache/gora/solr/GoraSolrTestDriver.java
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gora.solr;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.gora.GoraTestDriver;
+import org.apache.gora.solr.store.SolrStore;
+import org.apache.solr.client.solrj.embedded.JettySolrRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GoraSolrTestDriver extends GoraTestDriver {
+  private static final Logger logger = LoggerFactory.getLogger(GoraSolrTestDriver.class);
+  
+  
+  //Embedded JettySolr server
+  JettySolrRunner solr;
+
+  public GoraSolrTestDriver() {
+    super(SolrStore.class);
+  }
+
+  @Override
+  public void setUpClass() throws Exception {
+    super.setUpClass();
+    solr = new JettySolrRunner("src/test/conf/solr","/solr", 9876);
+    solr.start();
+  }
+
+  @Override
+  public void tearDownClass() throws Exception {
+    super.tearDownClass();
+    if (solr != null) {
+      solr.stop();
+      solr = null;
+    }
+    cleanupDirectoriesFailover();
+  }
+
+  /**
+   * Simply cleans up Solr's output from the Unit tests.
+   * In the case of a failure, it waits 250 msecs and tries again, 3 times in total.
+   */
+  private void cleanupDirectoriesFailover() {
+    int tries = 3;
+    while (tries-- > 0) {
+      try {
+        cleanupDirectories();
+        break;
+      } catch (Exception e) {
+        //ignore exception
+        try {
+          Thread.sleep(250);
+        } catch (InterruptedException e1) {
+          //ignore exception
+        }
+      }
+    }
+  } 
+
+  /**
+   * Cleans up Solr's temp base directory.
+   *
+   * @throws Exception
+   *    if an error occurs
+   */
+  private void cleanupDirectories() throws Exception {
+    File employeeDirFile = new File("src/test/conf/solr/Employee/data");
+    File webpageDirFile = new File("src/test/conf/solr/WebPage/data");
+    if (employeeDirFile.exists()) {
+      FileUtils.deleteDirectory(employeeDirFile);
+    }
+    if (webpageDirFile.exists()) {
+      FileUtils.deleteDirectory(webpageDirFile);
+    }
+  }
+
+  @Override
+  protected void setProperties(Properties properties) {
+    super.setProperties(properties);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/gora-solr-5/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
----------------------------------------------------------------------
diff --git a/gora-solr-5/src/test/java/org/apache/gora/solr/store/TestSolrStore.java b/gora-solr-5/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
new file mode 100644
index 0000000..da33e6b
--- /dev/null
+++ b/gora-solr-5/src/test/java/org/apache/gora/solr/store/TestSolrStore.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gora.solr.store;
+
+import java.io.IOException;
+
+import org.apache.gora.examples.generated.Employee;
+import org.apache.gora.examples.generated.WebPage;
+import org.apache.gora.solr.GoraSolrTestDriver;
+import org.apache.gora.store.DataStore;
+import org.apache.gora.store.DataStoreFactory;
+import org.apache.gora.store.DataStoreTestBase;
+import org.junit.Ignore;
+
+public class TestSolrStore extends DataStoreTestBase {
+  
+  static {
+    setTestDriver(new GoraSolrTestDriver());
+  }
+
+  @Override
+  protected DataStore<String, Employee> createEmployeeDataStore()
+      throws IOException {
+    SolrStore<String, Employee> store = new SolrStore<>();
+    store.initialize(String.class, Employee.class, DataStoreFactory.createProps());
+    return store;
+  }
+
+  @Override
+  protected DataStore<String, WebPage> createWebPageDataStore()
+      throws IOException {
+    SolrStore<String, WebPage> store = new SolrStore<>();
+    store.initialize(String.class, WebPage.class, DataStoreFactory.createProps());
+    return store;
+  }
+
+
+  @Ignore("GORA-310 and GORA-311 issues are not fixed at SolrStore")
+  @Override
+  public void testDeleteByQueryFields() throws IOException {}
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/gora-solr/pom.xml
----------------------------------------------------------------------
diff --git a/gora-solr/pom.xml b/gora-solr/pom.xml
index 80250dc..38126b8 100644
--- a/gora-solr/pom.xml
+++ b/gora-solr/pom.xml
@@ -29,7 +29,7 @@
   <artifactId>gora-solr</artifactId>
   <packaging>bundle</packaging>
 
-  <name>Apache Gora :: Solr</name>
+  <name>Apache Gora :: Solr4</name>
 
   <properties>
     <osgi.import>*</osgi.import>
@@ -147,12 +147,9 @@
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-core</artifactId>
+      <version>${lucene-solr.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>org.restlet.jee</groupId>
-          <artifactId>org.restlet.ext.servlet</artifactId>
-        </exclusion>
-        <exclusion>
           <groupId>org.eclipse.jetty.orbit</groupId>
           <artifactId>javax.servlet</artifactId>
         </exclusion>
@@ -161,6 +158,7 @@
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-solrj</artifactId>
+      <version>${lucene-solr.version}</version>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
@@ -238,6 +236,7 @@
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-test-framework</artifactId>
+      <version>${lucene-solr.version}</version>
       <exclusions>
         <exclusion>
           <groupId>org.eclipse.jetty</groupId>
@@ -249,6 +248,7 @@
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-test-framework</artifactId>
+      <version>${lucene-solr.version}</version>
       <scope>test</scope>
     </dependency>
   </dependencies>

http://git-wip-us.apache.org/repos/asf/gora/blob/348e020e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ef39ec3..565f3e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -712,6 +712,7 @@
     <module>gora-shims-hadoop2</module>
     <module>gora-shims-distribution</module>
     <module>gora-solr</module>
+    <module>gora-solr-5</module>
     <module>gora-tutorial</module>
     <module>sources-dist</module>
   </modules>
@@ -721,7 +722,7 @@
     <osgi.version>4.2.0</osgi.version>
     <!-- Avro Dependencies -->
     <avro.version>1.7.6</avro.version>
-    <jackson.version>1.6.9</jackson.version>
+<!--     <jackson.version>1.6.9</jackson.version> -->
     <!-- Hadoop Dependencies -->
     <hadoop-1.version>1.2.1</hadoop-1.version>
     <hadoop-2.version>2.5.2</hadoop-2.version>
@@ -738,6 +739,8 @@
     <!-- Solr Dependencies -->
     <lucene-solr.version>4.10.3</lucene-solr.version>
     <solr-solrj.version>4.10.3</solr-solrj.version>
+    <lucene-solr-5.version>5.5.1</lucene-solr-5.version>
+    <solr-solrj-5.version>5.5.1</solr-solrj-5.version>
     <jetty.version>8.1.8.v20121106</jetty.version>
     <tika.version>1.7</tika.version>
     <httpcomponents.version>4.3.1</httpcomponents.version>
@@ -888,16 +891,16 @@
       </dependency>
 
       <!-- Avro needs this version of jackson -->
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-core-asl</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-mapper-asl</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
+<!--       <dependency> -->
+<!--         <groupId>org.codehaus.jackson</groupId> -->
+<!--         <artifactId>jackson-core-asl</artifactId> -->
+<!--         <version>${jackson.version}</version> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.codehaus.jackson</groupId> -->
+<!--         <artifactId>jackson-mapper-asl</artifactId> -->
+<!--         <version>${jackson.version}</version> -->
+<!--       </dependency> -->
 
       <dependency>
         <groupId>org.apache.hadoop</groupId>
@@ -1044,32 +1047,32 @@
       </dependency>
 
       <!-- Solr Dependencies -->
-      <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-core</artifactId>
-        <version>${lucene-solr.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-solrj</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-test-framework</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-test-framework</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
+<!--       <dependency> -->
+<!--         <groupId>org.apache.solr</groupId> -->
+<!--         <artifactId>solr-core</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--         <exclusions> -->
+<!--           <exclusion> -->
+<!--             <groupId>org.eclipse.jetty.orbit</groupId> -->
+<!--             <artifactId>javax.servlet</artifactId> -->
+<!--           </exclusion> -->
+<!--         </exclusions> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.solr</groupId> -->
+<!--         <artifactId>solr-solrj</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.solr</groupId> -->
+<!--         <artifactId>solr-test-framework</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.lucene</groupId> -->
+<!--         <artifactId>lucene-test-framework</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
       <dependency>
         <groupId>com.ibm.icu</groupId>
         <artifactId>icu4j</artifactId>
@@ -1123,11 +1126,6 @@
         </exclusions>
       </dependency>
       <dependency>
-        <groupId>org.noggit</groupId>
-        <artifactId>noggit</artifactId>
-        <version>0.5</version>
-      </dependency>
-      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.1.1</version>
@@ -1341,22 +1339,22 @@
         <version>2.0.10</version>
       </dependency>
 
-      <!-- Lucene Dependencies -->
-      <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-core</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-analyzers-common</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-queries</artifactId>
-        <version>${lucene-solr.version}</version>
-      </dependency>
+<!--       Lucene Dependencies -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.lucene</groupId> -->
+<!--         <artifactId>lucene-core</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.lucene</groupId> -->
+<!--         <artifactId>lucene-analyzers-common</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
+<!--       <dependency> -->
+<!--         <groupId>org.apache.lucene</groupId> -->
+<!--         <artifactId>lucene-queries</artifactId> -->
+<!--         <version>${lucene-solr.version}</version> -->
+<!--       </dependency> -->
 
       <!-- Amazon Dependencies -->
       <dependency>


Mime
View raw message