Pass in the pointer to the test-materials area for both maven and ant, so the test doesn't have to care

git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/trunk@1881672 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java b/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java
index e550952..19c95e7 100644
--- a/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java
+++ b/connectors/elasticsearch/connector/src/test/java/org/apache/manifoldcf/agents/output/elasticsearch/tests/BaseITHSQLDB.java
@@ -81,15 +81,25 @@
   {
     final ProcessBuilder pb = new ProcessBuilder();
     
+    if (System.getenv("JAVA_HOME")!= null) {
+      pb.environment().put("JAVA_HOME", System.getenv("JAVA_HOME"));
+    } else {
+      throw new Exception("JAVA_HOME is required to be set for this test");
+    }
+    
     final File absFile = new File(".").getAbsoluteFile();
     System.out.println("ES working directory is '"+absFile+"'");
     pb.directory(absFile);
     
+    final String testMaterialsPath = System.getProperty("testMaterialsPath");
+    if (testMaterialsPath == null) {
+      throw new Exception("Can't find testMaterialsPath argument; test cannot be run");
+    }
     if (isUnix) {
-      pb.command("bash", "-c", "../test-materials/unix/elasticsearch-7.6.2/bin/elasticsearch -q -Expack.ml.enabled=false");
+      pb.command("bash", "-c", testMaterialsPath + "unix/elasticsearch-7.6.2/bin/elasticsearch -q -Expack.ml.enabled=false");
       System.out.println("Unix process");
     } else {
-      pb.command("cmd.exe", "/c", "..\\test-materials\\windows\\elasticsearch-7.6.2\\bin\\elasticsearch.bat -q -Expack.ml.enabled=false");
+      pb.command("cmd.exe", "/c", testMaterialsPath.replace("/", "\\") + "windows\\elasticsearch-7.6.2\\bin\\elasticsearch.bat -q -Expack.ml.enabled=false");
       System.out.println("Windows process");
     }
 
diff --git a/connectors/elasticsearch/pom.xml b/connectors/elasticsearch/pom.xml
index 3e4c571..a81c2e9 100644
--- a/connectors/elasticsearch/pom.xml
+++ b/connectors/elasticsearch/pom.xml
@@ -171,6 +171,7 @@
             <crawlerWarPath>../dependency/mcf-crawler-ui.war</crawlerWarPath>

             <authorityserviceWarPath>../dependency/mcf-authority-service.war</authorityserviceWarPath>

             <apiWarPath>../dependency/mcf-api-service.war</apiWarPath>

+            <testMaterialsPath>../../test-materials/</testMaterialsPath>

           </systemPropertyVariables>

           <excludes>

             <exclude>**/*Postgresql*.java</exclude>

diff --git a/framework/buildfiles/connector-build.xml b/framework/buildfiles/connector-build.xml
index 1381fe6..0252d27 100644
--- a/framework/buildfiles/connector-build.xml
+++ b/framework/buildfiles/connector-build.xml
@@ -1048,6 +1048,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1071,6 +1072,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1094,6 +1096,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1117,6 +1120,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1140,6 +1144,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1163,6 +1168,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1186,6 +1192,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1209,6 +1216,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1236,6 +1244,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1263,6 +1272,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1290,6 +1300,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>
@@ -1317,6 +1328,7 @@
 	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
 	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
 	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
+              <jvmarg value="-DtestMaterialsPath=../test-materials/"/>
 	    <classpath>
 		<fileset dir="${env.JAVA_HOME}/lib">
 		    <include name="tools.jar"/>