HTraceConfiguration { public abstract String get(String key);  static HTraceConfiguration fromMap(Map<String, String> conf); static HTraceConfiguration fromKeyValuePairs(String... pairs); abstract String get(String key); abstract String get(String key, String defaultValue); boolean getBoolean(String key, boolean defaultValue); int getInt(String key, int defaultVal); static final HTraceConfiguration EMPTY; }
@Test public void testPropertyConfiguration() throws Exception { System.setProperty("supercalifragilistic.property", "1"); System.setProperty("htrace.supercalifragilistic.property", "2"); System.setProperty("foo.htrace.supercalifragilistic.property", "3"); JavaPropertyConfiguration conf = new JavaPropertyConfiguration.Builder(). addPrefix("foo.htrace."). build(); assertEquals("3", conf.get("supercalifragilistic.property")); JavaPropertyConfiguration conf2 = new JavaPropertyConfiguration.Builder(). build(); assertEquals("2", conf2.get("supercalifragilistic.property")); assertTrue(null == conf.get("superfly")); assertTrue(null == conf2.get("superfly")); }