Author: kwright
Date: Sun May 3 10:50:58 2020
New Revision: 1877317
URL: http://svn.apache.org/viewvc?rev=1877317&view=rev
Log:
Get the ES process to start at least
Modified:
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/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=1877317&r1=1877316&r2=1877317&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 May 3 10:50:58 2020
@@ -32,6 +32,7 @@ import org.apache.http.HttpEntity;
import org.apache.http.util.EntityUtils;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;
+import java.io.File;
/**
@@ -78,23 +79,26 @@ public class BaseITHSQLDB extends org.ap
public void setupElasticSearch()
throws Exception
{
- System.out.println("ElasticSearch is starting...");
- //the default port is 9200
-
- // Call the test-materials script in the appropriate way
+ final ProcessBuilder pb = new ProcessBuilder();
+
+ final File absFile = new File(".").getAbsoluteFile();
+ System.out.println("ES working directory is '"+absFile+"'");
+ pb.directory(absFile);
+
if (isUnix) {
- esTestProcess = Runtime.getRuntime().exec(new String[]{
- "bash",
- "test-materials/elasticsearch-7.6.2/bin/elasticsearch",
- "-q"},
- null);
+ pb.command("bash", "-c",
"../test-materials/elasticsearch-7.6.2/bin/elasticsearch -q");
+ System.out.println("Unix process");
} else {
- esTestProcess = Runtime.getRuntime().exec(new String[]{
- "cmd",
- "test-materials/elasticsearch-7.6.2/bin/elasticsearch.bat",
- "-q"},
- null);
+ pb.command("cmd.exe",
"..\\test-materials\\elasticsearch-7.6.2\\bin\\elasticsearch.bat -q");
+ System.out.println("Windows process");
}
+
+ File log = new File("log");
+ pb.redirectErrorStream(true);
+ pb.redirectOutput(ProcessBuilder.Redirect.appendTo(log));
+ esTestProcess = pb.start();
+ System.out.println("ElasticSearch is starting...");
+ //the default port is 9200
waitForElasticSearch();