1 23 package com.sun.enterprise.tools.verifier.tests.wsclients; 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 HandlerClassCheck extends WSClientTest implements WSClientCheck { 46 47 51 public Result check (ServiceReferenceDescriptor descriptor) { 52 53 Result result = getInitializedResult(); 54 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 55 ClassLoader loader = getVerifierContext().getClassLoader(); 56 57 if (descriptor.hasHandlers()) { 58 List handlerChain = descriptor.getHandlerChain(); 59 for (Iterator it = handlerChain.iterator(); it.hasNext();) { 60 String hClass = ((WebServiceHandler)it.next()).getHandlerClass(); 61 Class cl = null; 62 try { 63 cl = Class.forName(hClass, false, getVerifierContext().getClassLoader()); 64 if ((cl != null) && ((javax.xml.rpc.handler.Handler .class).isAssignableFrom(cl))) { 65 result.addGoodDetails(smh.getLocalString 67 ("tests.componentNameConstructor", 68 "For [ {0} ]", 69 new Object [] {compName.toString()})); 70 result.passed(smh.getLocalString (getClass().getName() + ".passed", 71 "The Handler Class [{0}] exists and implements the javax.xml.rpc.handler.Handler Interface.", 72 new Object [] {hClass})); 73 74 } 75 else { 76 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 77 "For [ {0} ]", new Object [] {compName.toString()})); 78 result.failed(smh.getLocalString (getClass().getName() + ".failed", 79 "Handler Class [{0}] does not implement javax.xml.rpc.handler.Handler", 80 new Object [] {hClass})); 81 82 } 83 } 84 catch (ClassNotFoundException e) { 85 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 87 "For [ {0} ]", new Object [] {compName.toString()})); 88 result.failed(smh.getLocalString ( 89 "com.sun.enterprise.tools.verifier.tests.webservices.clfailed", 90 "The [{0}] Class [{1}] could not be Loaded", 91 new Object [] {"Handler Class", hClass})); 92 93 } 94 } 95 } 96 else { 97 result.addNaDetails(smh.getLocalString 99 ("tests.componentNameConstructor", "For [ {0} ]", 100 new Object [] {compName.toString()})); 101 result.notApplicable(smh.getLocalString 102 ( getClass().getName() + ".notapp", 103 "Not Applicable since No handlers defined in this WebService")); 104 } 105 106 return result; 107 } 108 } 109 110 | Popular Tags |