@Test public void load() { System.setProperty("somedb.username", "user0"); SystemPropertiesStore store = new SystemPropertiesStore(); List<TaggedPropertySet> set = store.parseConfiguration(); assertNotNull(set); assertEquals(1, set.size()); assertEquals("user0", set.get(0).getProperties().get("somedb.username")); assertEquals(System.getenv().get("USER"), set.get(0).getProperties().get("USER")); System.setProperty("USER", "mrTest"); store = new SystemPropertiesStore(); set = store.parseConfiguration(); assertEquals("mrTest", set.get(0).getProperties().get("USER")); }
public List<TaggedPropertySet> parseConfiguration() { final Map<String, String> properties = new HashMap<String, String>(); Properties systemProperties = getProperties(); Set<Map.Entry<String, String>> systemEnv = System.getenv().entrySet(); for (Map.Entry<String, String> envEntry : systemEnv) { properties.put(envEntry.getKey(),envEntry.getValue()); } for (Object key : systemProperties.keySet()) { String keyAsString = (String) key; properties.put(keyAsString, getProperty(keyAsString)); } return new ArrayList<TaggedPropertySet>() { { add(new TaggedPropertySet(ConfigurationValue.ALL_TAG, properties, SystemPropertiesStore.class)); } }; }
SystemPropertiesStore implements ConfigurationStore { public List<TaggedPropertySet> parseConfiguration() { final Map<String, String> properties = new HashMap<String, String>(); Properties systemProperties = getProperties(); Set<Map.Entry<String, String>> systemEnv = System.getenv().entrySet(); for (Map.Entry<String, String> envEntry : systemEnv) { properties.put(envEntry.getKey(),envEntry.getValue()); } for (Object key : systemProperties.keySet()) { String keyAsString = (String) key; properties.put(keyAsString, getProperty(keyAsString)); } return new ArrayList<TaggedPropertySet>() { { add(new TaggedPropertySet(ConfigurationValue.ALL_TAG, properties, SystemPropertiesStore.class)); } }; } }
SystemPropertiesStore implements ConfigurationStore { public List<TaggedPropertySet> parseConfiguration() { final Map<String, String> properties = new HashMap<String, String>(); Properties systemProperties = getProperties(); Set<Map.Entry<String, String>> systemEnv = System.getenv().entrySet(); for (Map.Entry<String, String> envEntry : systemEnv) { properties.put(envEntry.getKey(),envEntry.getValue()); } for (Object key : systemProperties.keySet()) { String keyAsString = (String) key; properties.put(keyAsString, getProperty(keyAsString)); } return new ArrayList<TaggedPropertySet>() { { add(new TaggedPropertySet(ConfigurationValue.ALL_TAG, properties, SystemPropertiesStore.class)); } }; }  }
SystemPropertiesStore implements ConfigurationStore { public List<TaggedPropertySet> parseConfiguration() { final Map<String, String> properties = new HashMap<String, String>(); Properties systemProperties = getProperties(); Set<Map.Entry<String, String>> systemEnv = System.getenv().entrySet(); for (Map.Entry<String, String> envEntry : systemEnv) { properties.put(envEntry.getKey(),envEntry.getValue()); } for (Object key : systemProperties.keySet()) { String keyAsString = (String) key; properties.put(keyAsString, getProperty(keyAsString)); } return new ArrayList<TaggedPropertySet>() { { add(new TaggedPropertySet(ConfigurationValue.ALL_TAG, properties, SystemPropertiesStore.class)); } }; }  List<TaggedPropertySet> parseConfiguration(); }
SystemPropertiesStore implements ConfigurationStore { public List<TaggedPropertySet> parseConfiguration() { final Map<String, String> properties = new HashMap<String, String>(); Properties systemProperties = getProperties(); Set<Map.Entry<String, String>> systemEnv = System.getenv().entrySet(); for (Map.Entry<String, String> envEntry : systemEnv) { properties.put(envEntry.getKey(),envEntry.getValue()); } for (Object key : systemProperties.keySet()) { String keyAsString = (String) key; properties.put(keyAsString, getProperty(keyAsString)); } return new ArrayList<TaggedPropertySet>() { { add(new TaggedPropertySet(ConfigurationValue.ALL_TAG, properties, SystemPropertiesStore.class)); } }; }  List<TaggedPropertySet> parseConfiguration();  }