You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2020/04/26 14:12:13 UTC

svn commit: r1877026 - in /manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch: build.xml connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java

Author: kwright
Date: Sun Apr 26 14:12:13 2020
New Revision: 1877026

URL: http://svn.apache.org/viewvc?rev=1877026&view=rev
Log:
Add fleshed out startup code.  Won't start though because mapper attachment plugin is wrong version

Modified:
    manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/build.xml
    manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java

Modified: manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/build.xml?rev=1877026&r1=1877025&r2=1877026&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/build.xml (original)
+++ manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/build.xml Sun Apr 26 14:12:13 2020
@@ -49,12 +49,12 @@
         <antcall target="download-via-maven">
             <param name="project-path" value="${elasticsearch-package}"/>
             <param name="artifact-version" value="${elasticsearch.mapper-attachments.version}"/>
-            <param name="target" value="test-materials/elasticsearch-${elasticsearch.version}/plugins"/>
+            <param name="target" value="build/download"/>
             <param name="artifact-name" value="elasticsearch-mapper-attachments"/>
             <param name="artifact-type" value="zip"/>
         </antcall>
 
-        <unzip src="test-materials/elasticsearch-${elasticsearch.version}/plugins/elasticsearch-mapper-attachments-${elasticsearch.mapper-attachments.version}.zip" dest="test-materials/elasticsearch-${elasticsearch.version}/plugins/mapper-attachments"/>
+        <unzip src="build/downloads/elasticsearch-${elasticsearch.mapper-attachments.version}/elasticsearch-mapper-attachments-${elasticsearch.mapper-attachments.version}.zip" dest="test-materials/elasticsearch-${elasticsearch.version}/plugins/mapper-attachments"/>
     </target>
 
     <target name="download-elasticsearch-unix" if="isUnix">

Modified: manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java?rev=1877026&r1=1877025&r2=1877026&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java (original)
+++ manifoldcf/branches/CONNECTORS-1639/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java Sun Apr 26 14:12:13 2020
@@ -18,7 +18,6 @@
 */
 package org.apache.manifoldcf.agents.output.elasticsearch.tests;
 
-import org.elasticsearch.node.Node;
 import org.junit.After;
 import org.junit.Before;
 
@@ -26,8 +25,6 @@ import org.eclipse.jetty.server.handler.
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.webapp.WebAppContext;
 
-import static org.elasticsearch.node.NodeBuilder.*;
-
 /**  
  *  Base integration tests class for Elastic Search tested against a CMIS repository
  *  @author Piergiorgio Lucidi
@@ -35,7 +32,16 @@ import static org.elasticsearch.node.Nod
  * */
 public class BaseITHSQLDB extends org.apache.manifoldcf.crawler.tests.BaseITHSQLDB
 {
-  protected Node node = null;
+
+  final static boolean isUnix;
+  static {
+    final String os = System.getProperty("os.name").toLowerCase();
+    if (os.contains("win")) {
+      isUnix = false;
+    } else {
+      isUnix = true;
+    }
+  }
 
   protected String[] getConnectorNames()
   {
@@ -57,22 +63,39 @@ public class BaseITHSQLDB extends org.ap
     return new String[]{"org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchConnector"};
   }
 
+  Process esTestProcess = null;
+  
   @Before
   public void setupElasticSearch()
     throws Exception
   {
-    //Initialize ElasticSearch server
-    //the default port is 9200
     System.out.println("ElasticSearch is starting...");
-    node = nodeBuilder().local(true).node();
+    //the default port is 9200
+
+    // Call the test-materials script in the appropriate way
+    if (isUnix) {
+      esTestProcess = Runtime.exec(new String[]{
+        "bash", 
+        "test-materials/elasticsearch-7.6.2/bin/elasticsearch",
+        "-q"},
+        null);
+    } else {
+      esTestProcess = Runtime.exec(new String[]{
+        "cmd", 
+        "test-materials/elasticsearch-7.6.2/bin/elasticsearch.bat",
+        "-q"},
+        null);
+    }
+    
     System.out.println("ElasticSearch is started on port 9200");
   }
   
   
   @After
   public void cleanUpElasticSearch(){
-    if(node!=null)
-      node.close();
+    if (esTestProcess != null) {
+      esTestProcess.destroy();
+    }
   }
   
 }