@Test public void testSystemPropertiesHasPriorityOverClasspath() throws IOException { System.getProperties().setProperty(XmlPropertyReader.CONFIG_PROPERTY, CONFIG_FILE1); BufferedReader reader = new BufferedReader(new InputStreamReader(propertyReader.getConfigurationStream(null))); StringBuilder buf = new StringBuilder(); String line; while( (line = reader.readLine()) != null ) { buf.append(line).append("\n"); } reader.close(); assertThat(buf.toString(), containsString("<feature name=\"test\"")); }
protected InputStream getConfigurationStream(final Properties props) { InputStream result = getConfigStreamFromProperties(props); if (result != null) { return result; } result = getConfigStreamFromProperties(System.getProperties()); if (result != null) { return result; } result = resourceClassLoader.getResourceAsStream(CONFIG_FILE_NAME); if (result != null) { return result; } return null; }
XmlPropertyReader extends RefreshablePropertyReader { protected InputStream getConfigurationStream(final Properties props) { InputStream result = getConfigStreamFromProperties(props); if (result != null) { return result; } result = getConfigStreamFromProperties(System.getProperties()); if (result != null) { return result; } result = resourceClassLoader.getResourceAsStream(CONFIG_FILE_NAME); if (result != null) { return result; } return null; } }
XmlPropertyReader extends RefreshablePropertyReader { protected InputStream getConfigurationStream(final Properties props) { InputStream result = getConfigStreamFromProperties(props); if (result != null) { return result; } result = getConfigStreamFromProperties(System.getProperties()); if (result != null) { return result; } result = resourceClassLoader.getResourceAsStream(CONFIG_FILE_NAME); if (result != null) { return result; } return null; } XmlPropertyReader(ClassLoader resourceClassLoader);  XmlPropertyReader(); }
XmlPropertyReader extends RefreshablePropertyReader { protected InputStream getConfigurationStream(final Properties props) { InputStream result = getConfigStreamFromProperties(props); if (result != null) { return result; } result = getConfigStreamFromProperties(System.getProperties()); if (result != null) { return result; } result = resourceClassLoader.getResourceAsStream(CONFIG_FILE_NAME); if (result != null) { return result; } return null; } XmlPropertyReader(ClassLoader resourceClassLoader);  XmlPropertyReader();  }
XmlPropertyReader extends RefreshablePropertyReader { protected InputStream getConfigurationStream(final Properties props) { InputStream result = getConfigStreamFromProperties(props); if (result != null) { return result; } result = getConfigStreamFromProperties(System.getProperties()); if (result != null) { return result; } result = resourceClassLoader.getResourceAsStream(CONFIG_FILE_NAME); if (result != null) { return result; } return null; } XmlPropertyReader(ClassLoader resourceClassLoader);  XmlPropertyReader();  static final String CONFIG_PROPERTY; static final String CONFIG_FILE_NAME; }