Param Value exists test.
*
Set servlets;
Iterator itr;
String epValue;
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
WebComponentDescriptor servlet;
Enumeration en;
EnvironmentProperty ep = null;
boolean oneFailed = false;
boolean status = false;
boolean notApp = false;
if (!descriptor.getServletDescriptors().isEmpty()) {
// get the servlets in this .war
servlets = descriptor.getServletDescriptors();
itr = servlets.iterator();
// test the servlets in this .war
while (itr.hasNext()) {
servlet = (WebComponentDescriptor)itr.next();
en = servlet.getInitializationParameters();
if (en.hasMoreElements()) {
ep = (EnvironmentProperty)en.nextElement();
epValue = ep.getValue();
if (epValue.length() != 0) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"Param named/value exists for in the servlet [ {0} ].",
new Object[] {servlet.getName()}));
} else {
// failed
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: Param name/value entry should of finite length."));
}
}
}
} else {
notApp = true;
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no initialization parameters for the servlet within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else if (notApp){
result.setStatus(Result.NOT_APPLICABLE);
} else {
result.setStatus(Result.PASSED);
}
return result;