Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/619#discussion_r122715999
  
    --- Diff: 
metron-platform/metron-elasticsearch/src/test/java/org/apache/metron/elasticsearch/integration/components/ElasticSearchComponent.java
 ---
    @@ -102,40 +103,57 @@ public void start() throws UnableToStartException {
                 throw new UnableToStartException("Unable to clean log or data 
directories", e);
             }
     
    -        Settings.Builder settingsBuilder = Settings.settingsBuilder()
    -                .put("node.http.enabled", true)
    -                .put("http.port", httpPort)
    +        Settings.Builder settingsBuilder = Settings.builder()
    +                .put("cluster.name", "metron")
                     .put("path.logs",logDir.getAbsolutePath())
                     .put("path.data",dataDir.getAbsolutePath())
                     .put("path.home", indexDir.getAbsoluteFile())
    -                .put("index.number_of_shards", 1)
    -                .put("node.mode", "network")
    -                .put("index.number_of_replicas", 1);
    +                .put("transport.type", "netty4");
    +
     
             if(extraElasticSearchSettings != null) {
     
                 settingsBuilder = 
settingsBuilder.put(extraElasticSearchSettings);
    -
             }
     
    -        node = 
NodeBuilder.nodeBuilder().settings(settingsBuilder).clusterName("metron").node();
    -        node.start();
    +        Collection plugins = Collections.singletonList(Netty4Plugin.class);
     
    +        node = new PluginConfigurableNode(settingsBuilder.build(), 
plugins);
             client = node.client();
     
    -        waitForCluster(client, ClusterHealthStatus.YELLOW, new 
TimeValue(60000));
    +        waitForCluster(node, ClusterHealthStatus.YELLOW, new 
TimeValue(60000));
     
         }
     
    -    public static void waitForCluster(ElasticsearchClient client, 
ClusterHealthStatus status, TimeValue timeout) throws UnableToStartException {
    +    private static class PluginConfigurableNode extends Node {
    +        PluginConfigurableNode(Settings settings, Collection<Class<? 
extends Plugin>> classpathPlugins) {
    +            super(InternalSettingsPreparer.prepareEnvironment(settings, 
null), classpathPlugins);
    +        }
    +    }
    +
    +    public static void waitForCluster(Node node, ClusterHealthStatus 
status, TimeValue timeout) throws UnableToStartException {
             try {
    +           node.start();
    +
                 ClusterHealthResponse healthResponse =
    -                    
(ClusterHealthResponse)client.execute(ClusterHealthAction.INSTANCE, new 
ClusterHealthRequest().waitForStatus(status).timeout(timeout)).actionGet();
    +                    (ClusterHealthResponse) 
node.client().execute(ClusterHealthAction.INSTANCE, new 
ClusterHealthRequest().waitForStatus(status).timeout(timeout)).actionGet();
                 if (healthResponse != null && healthResponse.isTimedOut()) {
                     throw new UnableToStartException("cluster state is " + 
healthResponse.getStatus().name()
                             + " and not " + status.name()
                             + ", from here on, everything will fail!");
                 }
    +
    +            byte[] indexTemplate = new byte[0];
    +            try {
    +                indexTemplate = 
Files.readAllBytes(Paths.get("/Users/wbekker/metron/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/files/yaf_index.template"));
    +            } catch (IOException e) {
    +                e.printStackTrace();
    --- End diff --
    
    Probably want to throw back up a Runtime Exception


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to