[ 
https://issues.apache.org/jira/browse/SDAP-161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16711744#comment-16711744
 ] 

ASF GitHub Bot commented on SDAP-161:
-------------------------------------

lewismc commented on a change in pull request #35: SDAP-161 MUDROD embedded 
unit test
URL: 
https://github.com/apache/incubator-sdap-mudrod/pull/35#discussion_r239540539
 
 

 ##########
 File path: 
core/src/test/java/org/apache/sdap/mudrod/driver/EmbeddedElasticsearchServer.java
 ##########
 @@ -0,0 +1,82 @@
+/*
+ * Licensed 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.sdap.mudrod.driver;
+
+import org.apache.commons.io.FileUtils;
+import org.elasticsearch.client.Client;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.node.Node;
+import org.elasticsearch.node.NodeValidationException;
+import org.elasticsearch.transport.Netty3Plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * embedded elasticsearch server.
+ */
+public class EmbeddedElasticsearchServer {
+
+  private static final String DEFAULT_DATA_DIRECTORY = 
"target/elasticsearch-data";
+
+  private Node node;
+  private final String dataDirectory;
+
+  public EmbeddedElasticsearchServer() {
+    this(DEFAULT_DATA_DIRECTORY);
+  }
+
+  public EmbeddedElasticsearchServer(String dataDirectory) {
+    this.dataDirectory = dataDirectory;
+
+    Settings.Builder settingsBuilder = Settings.builder();
+    settingsBuilder.put("http.type", "netty3");
+    settingsBuilder.put("transport.type", "netty3");
+    settingsBuilder.put("cluster.name", "MurdorES").put("http.enabled", 
"false").put("path.data", dataDirectory).put("path.home", "/");
+
+    Settings settings = settingsBuilder.build();
+    Collection plugins = Arrays.asList(Netty3Plugin.class);
+    node = null;
+    try {
+      node = new PluginConfigurableNode(settings, plugins).start();
+      System.out.println(node.toString());
+    } catch (NodeValidationException e) {
+      // TODO Auto-generated catch block
 
 Review comment:
   Remove TODO

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> MUDROD embedded unit test
> -------------------------
>
>                 Key: SDAP-161
>                 URL: https://issues.apache.org/jira/browse/SDAP-161
>             Project: Apache Science Data Analytics Platform
>          Issue Type: Improvement
>          Components: mudrod
>    Affects Versions: 1.0
>            Reporter: Yun Li
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to