1 2 24 package com.sun.enterprise.tools.verifier.tests.webservices; 25 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.tools.verifier.*; 28 import java.util.*; 29 import java.lang.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 32 35 36 67 public class EJBServiceImplBeanChk extends WSTest implements WSCheck { 68 69 73 public Result check (WebServiceEndpoint wsdescriptor) { 74 75 Result result = getInitializedResult(); 76 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 77 78 EjbDescriptor descriptor = wsdescriptor.getEjbComponentImpl(); 79 80 if (descriptor != null) { 81 82 String beanClass = descriptor.getEjbClassName(); 84 if ((beanClass == null) || ((beanClass != null) && (beanClass.length() == 0))) { 86 result.addErrorDetails(smh.getLocalString 88 ("com.sun.enterprise.tools.verifier.tests.webservices.Error", 89 "Error: Unexpected error occurred [ {0} ]", 90 new Object [] {"Service Implementation Bean Class Name Null"})); 91 } 92 Class <?> bean = null; 93 94 try { 95 bean = Class.forName(beanClass, false, getVerifierContext().getClassLoader()); 96 } catch (ClassNotFoundException e) { 97 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 98 "For [ {0} ]", new Object [] {compName.toString()})); 99 result.failed(smh.getLocalString 100 (getClass().getName() + ".failed", 101 "The [{0}] Class [{1}] could not be Loaded",new Object [] {"Service Impl Bean", beanClass})); 102 } 103 104 String s = descriptor.getWebServiceEndpointInterfaceName(); 106 107 if ((s == null) || (s.length() == 0)){ 108 result.addErrorDetails(smh.getLocalString 110 ("com.sun.enterprise.tools.verifier.tests.webservices.Error", 111 "Error: Unexpected error occurred [ {0} ]", 112 new Object [] {"Service Endpoint Interface Class Name Null"})); 113 } 114 115 Class <?> sei = null; 116 117 try { 118 sei = Class.forName(s, false, getVerifierContext().getClassLoader()); 119 }catch(ClassNotFoundException e) { 120 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 121 "For [ {0} ]", new Object [] {compName.toString()})); 122 result.failed(smh.getLocalString 123 (getClass().getName() + ".failed", 124 "The [{0}] Class [{1}] could not be Loaded",new Object [] {"SEI", s})); 125 126 } 127 128 boolean isSLSB = (javax.ejb.SessionBean .class).isAssignableFrom(bean); 130 boolean implementsSEI = sei.isAssignableFrom(bean); 131 132 if (!isSLSB) { 133 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 135 "For [ {0} ]", new Object [] {compName.toString()})); 136 result.failed(smh.getLocalString 137 ("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]", 138 new Object [] {"The Service Implementation Bean Does not Implement SessionBean Interface"})); 139 } 140 else { 141 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 143 "For [ {0} ]", new Object [] {compName.toString()})); 144 result.passed(smh.getLocalString ( 145 "com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]", 146 new Object [] {"The Service Impl Bean implements SessionBean Interface"})); 147 } 148 149 EndPointImplBeanClassChecker checker = new EndPointImplBeanClassChecker(sei,bean,result,getVerifierContext().getSchemaVersion()); 150 151 if (implementsSEI) { 152 result.addGoodDetails(smh.getLocalString 154 ("tests.componentNameConstructor", 155 "For [ {0} ]", 156 new Object [] {compName.toString()})); 157 result.passed(smh.getLocalString ( 158 "com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]", 159 new Object [] {"The Service Impl Bean implements SEI"})); 160 } 161 else { 162 163 Vector notImpl = checker.getSEIMethodsNotImplemented(); 166 if (notImpl.size() > 0) { 167 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 169 "For [ {0} ]", new Object [] {compName.toString()})); 170 result.failed(smh.getLocalString 171 ("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]", 172 new Object [] {"The Service Implementation Bean Does not Implement ALL SEI Methods"})); 173 } 174 else { 175 result.addGoodDetails(smh.getLocalString 177 ("tests.componentNameConstructor", 178 "For [ {0} ]", 179 new Object [] {compName.toString()})); 180 result.passed(smh.getLocalString ( 181 "com.sun.enterprise.tools.verifier.tests.webservices.passed", "[{0}]", 182 new Object [] {"The Service Impl Bean implements all Methods of the SEI"})); 183 } 184 } 185 186 if (checker.check(compName)) { 189 result.setStatus(Result.PASSED); 191 } 192 else { 193 result.setStatus(Result.FAILED); 195 } 196 197 } 198 else { 199 result.addNaDetails(smh.getLocalString 201 ("tests.componentNameConstructor", "For [ {0} ]", 202 new Object [] {compName.toString()})); 203 result.notApplicable(smh.getLocalString 204 ("com.sun.enterprise.tools.verifier.tests.webservices.notapp", 205 "[{0}]", new Object [] {"Not Applicable since this is a JAX-RPC Service Endpoint"})); 206 207 } 208 return result; 209 } 210 } 211 212 | Popular Tags |