@Test public void testOverrides() throws Exception { Configuration overrides = new PropertiesConfiguration(); overrides.addProperty("hadoop-common.p1", "overridden1"); overrides.addProperty("hadoop-common.p2", "overridden2"); overrides.addProperty("hadoop-common.fs.default.name", "not-overridden"); clusterSpec = ClusterSpec.withNoDefaults(overrides); Configuration conf = HadoopConfigurationBuilder.buildCommonConfiguration( clusterSpec, cluster, defaults); assertThat(Iterators.size(conf.getKeys()), is(3)); assertThat(conf.getString("p1"), is("overridden1")); assertThat(conf.getString("p2"), is("overridden2")); assertThat("Can't override dynamically set properties", conf.getString("fs.default.name"), matches("hdfs: }
@VisibleForTesting static Configuration buildCommonConfiguration(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults) throws ConfigurationException, IOException { Configuration config = build(clusterSpec, cluster, defaults, "hadoop-common"); Instance namenode = cluster .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE)); LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName()); config.setProperty("fs.default.name", String.format("hdfs: namenode.getPublicHostName())); return config; }
HadoopConfigurationBuilder { @VisibleForTesting static Configuration buildCommonConfiguration(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults) throws ConfigurationException, IOException { Configuration config = build(clusterSpec, cluster, defaults, "hadoop-common"); Instance namenode = cluster .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE)); LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName()); config.setProperty("fs.default.name", String.format("hdfs: namenode.getPublicHostName())); return config; } }
HadoopConfigurationBuilder { @VisibleForTesting static Configuration buildCommonConfiguration(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults) throws ConfigurationException, IOException { Configuration config = build(clusterSpec, cluster, defaults, "hadoop-common"); Instance namenode = cluster .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE)); LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName()); config.setProperty("fs.default.name", String.format("hdfs: namenode.getPublicHostName())); return config; }  }
HadoopConfigurationBuilder { @VisibleForTesting static Configuration buildCommonConfiguration(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults) throws ConfigurationException, IOException { Configuration config = build(clusterSpec, cluster, defaults, "hadoop-common"); Instance namenode = cluster .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE)); LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName()); config.setProperty("fs.default.name", String.format("hdfs: namenode.getPublicHostName())); return config; }  static Statement buildCommon(String path, ClusterSpec clusterSpec,
      Cluster cluster); static Statement buildHdfs(String path, ClusterSpec clusterSpec,
      Cluster cluster, Set<String> dataDirectories); static Statement buildMapReduce(String path, ClusterSpec clusterSpec,
      Cluster cluster, Set<String> dataDirectories); static Statement buildHadoopEnv(String path, ClusterSpec clusterSpec,
      Cluster cluster); }
HadoopConfigurationBuilder { @VisibleForTesting static Configuration buildCommonConfiguration(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults) throws ConfigurationException, IOException { Configuration config = build(clusterSpec, cluster, defaults, "hadoop-common"); Instance namenode = cluster .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE)); LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName()); config.setProperty("fs.default.name", String.format("hdfs: namenode.getPublicHostName())); return config; }  static Statement buildCommon(String path, ClusterSpec clusterSpec,
      Cluster cluster); static Statement buildHdfs(String path, ClusterSpec clusterSpec,
      Cluster cluster, Set<String> dataDirectories); static Statement buildMapReduce(String path, ClusterSpec clusterSpec,
      Cluster cluster, Set<String> dataDirectories); static Statement buildHadoopEnv(String path, ClusterSpec clusterSpec,
      Cluster cluster);  }