* @param testSuite the XML element.
* @param bc the bundle context
* @param configuration the configuration of the underlying OSGi platform
*/
private void showProperties(Xpp3Dom testSuite, BundleContext bc, Map configuration) {
Xpp3Dom properties = createElement(testSuite, "properties");
Properties systemProperties = System.getProperties();
if (systemProperties != null) {
Enumeration propertyKeys = systemProperties.propertyNames();
while (propertyKeys.hasMoreElements()) {
String key = (String) propertyKeys.nextElement();
String value = systemProperties.getProperty(key);
if (value == null) {
value = "null";
}
Xpp3Dom property = createElement(properties, "property");
property.setAttribute("name", key);
property.setAttribute("value", value);
}
}
if (configuration != null) {
Iterator it = configuration.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
Object obj = (Object) configuration.get(key);
String value = null;
if (obj == null) {
value = "null";
} else if (obj instanceof String) {
value = (String) obj;
} else {
value = obj.toString();
}
Xpp3Dom property = createElement(properties, "property");
property.setAttribute("name", key);
property.setAttribute("value", value);
}
}
Xpp3Dom bundle = createElement(properties, "property");
Bundle[] bundles = bc.getBundles();
for (int i = 0; i < bundles.length; i++) {
String sn = bundles[i].getSymbolicName();
String state = "UNKNOWN";
switch (bundles[i].getState()) {
case Bundle.ACTIVE:
state = "ACTIVE";
break;
case Bundle.INSTALLED:
state = "INSTALLED";
break;
case Bundle.RESOLVED:
state = "RESOLVED";
break;
case Bundle.UNINSTALLED:
state = "UNINSTALLED";
break;
default:
break;
}
bundle.setAttribute("name", "bundle-" + sn);
bundle.setAttribute("value", state);
}
}