1 23 package com.sun.enterprise.tools.verifier.tests.webservices; 24 25 import com.sun.enterprise.deployment.*; 26 import com.sun.enterprise.tools.verifier.*; 27 import java.util.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 import java.lang.reflect.*; 30 31 34 35 43 44 public class ServletUrlPatternExactCheck extends WSTest implements WSCheck { 45 46 50 public Result check (WebServiceEndpoint desc) { 51 52 Result result = getInitializedResult(); 53 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 54 55 boolean pass = true; 56 57 if (desc.implementedByWebComponent()) { 58 WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor(); 59 WebComponentDescriptor webComponent = 60 (WebComponentDescriptor) webBundle. 61 getWebComponentByCanonicalName(desc.getWebComponentLink()); 62 if(webComponent != null && webComponent.isServlet()) { 63 Enumeration en = webComponent.getUrlPatterns(); 64 while(en.hasMoreElements()) { 65 String pattern =(String ) en.nextElement(); 66 if (pattern.indexOf("*") == -1) { 67 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 69 "For [ {0} ]", new Object [] {compName.toString()})); 70 result.passed(smh.getLocalString (getClass().getName() + ".passed", 71 "The urlpattern for this servlet-mapping [{0}] is exact.", 72 new Object [] {pattern})); 73 74 } 75 else { 76 result.addErrorDetails(smh.getLocalString 78 ("tests.componentNameConstructor", "For [ {0} ]", 79 new Object [] {compName.toString()})); 80 result.failed(smh.getLocalString (getClass().getName() + ".failed", 81 "The urlpattern for this servlet-mapping [{0}] contains '*' and is not exact.", 82 new Object [] {pattern})); 83 84 pass = false; 85 } 86 break; 89 } 90 } 91 } 92 else { 93 result.addNaDetails(smh.getLocalString 95 ("tests.componentNameConstructor", "For [ {0} ]", 96 new Object [] {compName.toString()})); 97 result.notApplicable(smh.getLocalString 98 (getClass().getName() + ".notapp", 99 "Not Applicable since this not a JAX-RPC Service Endpoint.")); 100 } 101 102 return result; 103 } 104 } 105 106 | Popular Tags |