@Test public void testOverrideDefaults() throws Exception { Configuration baseConfig = new PropertiesConfiguration(); baseConfig.addProperty("whirr.provider", "aws-ec2"); baseConfig.addProperty("es.index.store.type", "fs"); ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig); Configuration config = ElasticSearchConfigurationBuilder.buildConfig(spec, null); assertThat(config.getString("es.index.store.type"), is("fs")); }
public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration( new PropertiesConfiguration(ElasticSearchConfigurationBuilder.class.getResource("/whirr-elasticsearch-default.properties"))); } catch (ConfigurationException e) { LOG.error("Configuration error", e); } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; }
ElasticSearchConfigurationBuilder { public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration( new PropertiesConfiguration(ElasticSearchConfigurationBuilder.class.getResource("/whirr-elasticsearch-default.properties"))); } catch (ConfigurationException e) { LOG.error("Configuration error", e); } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; } }
ElasticSearchConfigurationBuilder { public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration( new PropertiesConfiguration(ElasticSearchConfigurationBuilder.class.getResource("/whirr-elasticsearch-default.properties"))); } catch (ConfigurationException e) { LOG.error("Configuration error", e); } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; }  }
ElasticSearchConfigurationBuilder { public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration( new PropertiesConfiguration(ElasticSearchConfigurationBuilder.class.getResource("/whirr-elasticsearch-default.properties"))); } catch (ConfigurationException e) { LOG.error("Configuration error", e); } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; }  static Statement build(String path, Configuration config); static Statement build(String path, ClusterSpec spec, Cluster cluster); static Configuration buildConfig(ClusterSpec spec, Cluster cluster); @VisibleForTesting static List<String> asYamlLines(Configuration config); }
ElasticSearchConfigurationBuilder { public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) { CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(spec.getConfiguration()); try { config.addConfiguration( new PropertiesConfiguration(ElasticSearchConfigurationBuilder.class.getResource("/whirr-elasticsearch-default.properties"))); } catch (ConfigurationException e) { LOG.error("Configuration error", e); } if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) { addDefaultsForEC2(spec, config); } else { addDefaultsForUnicast(cluster, config); } if (!config.containsKey("es.cluster.name")) { config.addProperty("es.cluster.name", spec.getClusterName()); } return config; }  static Statement build(String path, Configuration config); static Statement build(String path, ClusterSpec spec, Cluster cluster); static Configuration buildConfig(ClusterSpec spec, Cluster cluster); @VisibleForTesting static List<String> asYamlLines(Configuration config); static final String ES_PREFIX; }