Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
boolean pass = true;
if (desc.implementedByWebComponent()) {
WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor();
WebComponentDescriptor webComponent =
(WebComponentDescriptor) webBundle.
getWebComponentByCanonicalName(desc.getWebComponentLink());
if(webComponent != null && webComponent.isServlet()) {
Enumeration en = webComponent.getUrlPatterns();
while(en.hasMoreElements()) {
String pattern =(String) en.nextElement();
if (pattern.indexOf("*") == -1) {
// result.pass
result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
"For [ {0} ]", new Object[] {compName.toString()}));
result.passed(smh.getLocalString (getClass().getName() + ".passed",
"The urlpattern for this servlet-mapping [{0}] is exact.",
new Object[] {pattern}));
}
else {
// result.fail
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor", "For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString (getClass().getName() + ".failed",
"The urlpattern for this servlet-mapping [{0}] contains '*' and is not exact.",
new Object[] {pattern}));
pass = false;
}
// we assume there is one servlet-mapping specified,
// this check is done in another test
break;
}
}
}
else {
//result.notapp
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor", "For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notapp",
"Not Applicable since this not a JAX-RPC Service Endpoint."));
}
return result;