TestConfiguration.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:hadoop 作者:
public void testPropertySource() throws IOException {
  out = new BufferedWriter(new FileWriter(CONFIG));
  startConfig();
  appendProperty("test.foo", "bar");
  endConfig();
  Path fileResource = new Path(CONFIG);
  conf.addResource(fileResource);
  conf.set("fs.defaultFS", "value");
  String [] sources = conf.getPropertySources("test.foo");
  assertEquals(1, sources.length);
  assertEquals(
      "Resource string returned for a file-loaded property" +
      " must be a proper absolute path",
      fileResource,
      new Path(sources[0]));
  assertArrayEquals("Resource string returned for a set() property must be " +
        "\"programatically\"",
      new String[]{"programatically"},
      conf.getPropertySources("fs.defaultFS"));
  assertEquals("Resource string returned for an unset property must be null",
      null, conf.getPropertySources("fs.defaultFoo"));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号