return result;
}
protected TestResult checkGetNames(PortletConfig config,
PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Retrieve the property names and ensure that "
+ "the required keys are present.");
List requiredKeys = new ArrayList();
requiredKeys.add(TITLE_KEY);
requiredKeys.add(SHORT_TITLE_KEY);
requiredKeys.add(KEYWORDS_KEY);
ResourceBundle bundle = config.getResourceBundle(request.getLocale());
if (bundle == null) {
result.setReturnCode(TestResult.WARNING);
result.setResultMessage("A function upon which this test depends "
+ "failed to execute as expected. "
+ "Check the other test results in this test suite.");
return result;
}
for (Enumeration en = bundle.getKeys(); en.hasMoreElements(); ) {
String key = (String) en.nextElement();
requiredKeys.remove(key);
}
if (requiredKeys.isEmpty()) {
result.setReturnCode(TestResult.PASSED);
} else {
result.setReturnCode(TestResult.FAILED);
StringBuffer buffer = new StringBuffer();
for (Iterator it = requiredKeys.iterator(); it.hasNext(); ) {
buffer.append(it.next()).append(", ");
}
result.setResultMessage("Required keys [" + buffer.toString()
+ "] are missing in the resource bundle.");
}
return result;
}