@Test public void testRemap() { Properties properties = new Properties(); properties.put("GRAPHITE_ENDPOINT", "XYZ"); properties.put("GRAPHITE_PATH", "123"); MetricReporterFactory.remap(new GraphiteConfigKeys().getKeys(), properties); Assert.assertEquals(properties.getProperty(GraphiteConfigKeys.ENDPOINT.getPropertyKey()), "XYZ"); Assert.assertEquals(properties.getProperty(GraphiteConfigKeys.PATH.getPropertyKey()), "123"); }
protected static void remap(Set<ConfigKey> keys, Properties properties) { for(ConfigKey key : keys) { String remappedKey = key.getPropertyKey().toUpperCase().replace('.', '_'); String value = properties.getProperty(remappedKey); if(value != null) properties.put(key.getPropertyKey(), value); } }
MetricReporterFactory { protected static void remap(Set<ConfigKey> keys, Properties properties) { for(ConfigKey key : keys) { String remappedKey = key.getPropertyKey().toUpperCase().replace('.', '_'); String value = properties.getProperty(remappedKey); if(value != null) properties.put(key.getPropertyKey(), value); } } }
MetricReporterFactory { protected static void remap(Set<ConfigKey> keys, Properties properties) { for(ConfigKey key : keys) { String remappedKey = key.getPropertyKey().toUpperCase().replace('.', '_'); String value = properties.getProperty(remappedKey); if(value != null) properties.put(key.getPropertyKey(), value); } } MetricReporterFactory(); }
MetricReporterFactory { protected static void remap(Set<ConfigKey> keys, Properties properties) { for(ConfigKey key : keys) { String remappedKey = key.getPropertyKey().toUpperCase().replace('.', '_'); String value = properties.getProperty(remappedKey); if(value != null) properties.put(key.getPropertyKey(), value); } } MetricReporterFactory(); MetricReporter createInstance(Map<String, String> environmentVariables); }
MetricReporterFactory { protected static void remap(Set<ConfigKey> keys, Properties properties) { for(ConfigKey key : keys) { String remappedKey = key.getPropertyKey().toUpperCase().replace('.', '_'); String value = properties.getProperty(remappedKey); if(value != null) properties.put(key.getPropertyKey(), value); } } MetricReporterFactory(); MetricReporter createInstance(Map<String, String> environmentVariables);  }