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 45 46 public class ServletImplClassCheck extends WSTest implements WSCheck { 47 48 52 public Result check (WebServiceEndpoint descriptor) { 53 54 Result result = getInitializedResult(); 55 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 56 57 boolean pass = true; 58 if (descriptor.implementedByWebComponent()) { 59 String servletClass=null; 60 ClassLoader loader = getVerifierContext().getClassLoader(); 61 WebComponentDescriptor wcd = descriptor.getWebComponentImpl(); 62 if (wcd!=null) 63 servletClass = wcd.getWebComponentImplementation(); 64 if ((servletClass == null) || (!descriptor.getWebComponentImpl().isServlet())) { 65 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 67 "For [ {0} ]", new Object [] {compName.toString()})); 68 result.failed(smh.getLocalString (getClass().getName() + ".failed1", 69 "The Web Component Implementation for this JAX-RPC Service Endpoint [{0}] is not a Servlet.", 70 new Object [] {compName.toString()})); 71 72 } 73 else { 74 try { 75 Class cl = Class.forName(servletClass, false, getVerifierContext().getClassLoader()); 76 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 78 "For [ {0} ]", new Object [] {compName.toString()})); 79 result.passed(smh.getLocalString (getClass().getName() + ".passed", 80 "The Servlet Implementation Class [{0}] was loaded successfully.", 81 new Object [] {servletClass})); 82 83 }catch (ClassNotFoundException e) { 84 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 86 "For [ {0} ]", new Object [] {compName.toString()})); 87 result.failed(smh.getLocalString (getClass().getName() + ".failed", 88 "The Servlet Implementation Class [{0}] was not found.", 89 new Object [] {servletClass})); 90 pass = false; 91 } 92 } 93 } 94 else { 95 result.addNaDetails(smh.getLocalString 97 ("tests.componentNameConstructor", "For [ {0} ]", 98 new Object [] {compName.toString()})); 99 result.notApplicable(smh.getLocalString (getClass().getName() + ".notapp", 100 "Not Applicable since this not a JAX-RPC Service Endpoint.")); 101 102 } 103 104 return result; 105 } 106 } 107 108 | Popular Tags |