in testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java [218:255]
private Properties getFelixConfiguration() {
String location = "/".concat(ClassUtils.classPackageAsResourcePath(getClass())).concat("/").concat(FELIX_CONF_FILE);
URL url = getClass().getResource(location);
if (url == null)
throw new RuntimeException("cannot find felix configuration properties file:" + location);
// used with Main
System.getProperties().setProperty(FELIX_CONFIG_PROPERTY, url.toExternalForm());
// load config.properties (use Felix's Main for resolving placeholders)
Properties props = new Properties();
InputStream is = null;
try {
is = url.openConnection().getInputStream();
props.load(is);
is.close();
}
catch (FileNotFoundException ex) {
// Ignore file not found.
}
catch (Exception ex) {
System.err.println("Main: Error loading system properties from " + url);
System.err.println("Main: " + ex);
try {
if (is != null) is.close();
}
catch (IOException ex2) {
// Nothing we can do.
}
return null;
}
// Perform variable substitution for system properties.
for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
String name = (String) e.nextElement();
props.setProperty(name, substVars(props.getProperty(name), name, null, props));
}
return props;
}