Listener class must implement a no arg constructor.
AppListenerDescriptor listener = null;
Enumeration listenerEnum;
Result result;
boolean oneFailed = false;
Class listenerClass = null;
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
listenerEnum = descriptor.getAppListenerDescriptors().elements();
if (listenerEnum.hasMoreElements()) {
result = loadWarFile(descriptor);
while (listenerEnum.hasMoreElements()) {
listener = (AppListenerDescriptor)listenerEnum.nextElement();
if (listener.getListener().equals(smh.getLocalString("JAXRPCContextListener","com.sun.xml.rpc.server.http.JAXRPCContextListener"))) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString (getClass().getName() + ".passed1",
"Listener Class Name is [ {0} ], make sure it is available in classpath at runtime.",
new Object[] {listener.getListener()}));
continue;
}
if ("".equals(listener.getListener())) {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString (getClass().getName() + ".failed",
"Empty or Null String specified for Listener Class Name in [ {0} ].",
new Object[] {compName.toString()}));
oneFailed = true;
continue;
}
listenerClass = loadClass(result, listener.getListener());
if (!runIndividualListenerTest(result, listenerClass))
oneFailed=true;
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else {
result.setStatus(Result.PASSED);
}
} else {
result = getInitializedResult();
result.setStatus(Result.NOT_APPLICABLE);
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.web.ListenerClass" + ".notApplicable",
"There are no listener components within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;