Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (desc.implementedByWebComponent()) {
WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor();
WebComponentDescriptor webComponent =
(WebComponentDescriptor) webBundle.
getWebComponentByCanonicalName(desc.getWebComponentLink());
if(webComponent != null && webComponent.isServlet()) {
int sz = getSize(webComponent.getUrlPatternsSet());
if (sz == 0) {
//result.fail , no servlet-mapping for servlet linked to port-component
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Found [{0}] servlet mappings for the servlet linked to by this port-component.",
new Object[] {"0"}));
}
if (sz > 1) {
//result.fail , more than one servlet-mapping for servlet linked to port-component
result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Found [{0}] servlet mappings for the servlet linked to by this port-component.",
new Object[] {Integer.toString(sz)}));
}
else {
//result.pass , one servlet-mapping for servlet linked to port-component
result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.passed(smh.getLocalString (getClass().getName() + ".passed",
"Found only one servlet mapping for the servlet linked to by this port-component."));
}
}
}
else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor", "For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notapp",
" Not applicable since this is Not a JAX-RPC Service Endpoint."));
}
return result;