1 23 package com.sun.enterprise.tools.verifier.tests.ejb.businessmethod; 24 25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 26 import java.lang.reflect.*; 27 import java.util.Set ; 28 29 import com.sun.enterprise.deployment.*; 30 import com.sun.enterprise.tools.verifier.*; 31 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 32 import com.sun.enterprise.tools.verifier.tests.ejb.RmiIIOPUtils; 33 import com.sun.enterprise.tools.verifier.tests.*; 34 35 42 public class BusinessMethodRmiIIOPArgs extends EjbTest implements EjbCheck { 43 44 Result result = null; 45 ComponentNameConstructor compName = null; 46 57 public Result check(EjbDescriptor descriptor) { 58 59 result = getInitializedResult(); 60 compName = getVerifierContext().getComponentNameConstructor(); 61 62 if ((descriptor instanceof EjbSessionDescriptor) || 63 (descriptor instanceof EjbEntityDescriptor)) { 64 if(descriptor.getRemoteClassName() != null && !"".equals(descriptor.getRemoteClassName())) 65 commonToBothInterfaces(descriptor.getRemoteClassName(),descriptor); 66 67 Set <String > remoteInterfaces = descriptor.getRemoteBusinessClassNames(); 68 for (String remoteIntf : remoteInterfaces) 69 commonToBothInterfaces(remoteIntf, descriptor); 70 } 71 if(result.getStatus() != Result.FAILED) { 72 addGoodDetails(result, compName); 73 result.passed(smh.getLocalString 74 (getClass().getName() + ".passed", 75 "Proper declaration of business method(s) found.")); 76 } 77 return result; 78 } 79 80 private void commonToBothInterfaces(String intf, EjbDescriptor descriptor) { 81 try { 82 Class intfClass = Class.forName(intf, 83 false, 84 getVerifierContext().getClassLoader()); 85 86 for (Method remoteMethod : intfClass.getMethods()) { 87 if (remoteMethod.getDeclaringClass().getName().equals("javax.ejb.EJBObject")) 89 continue; 90 91 Class beanClass = Class.forName(descriptor.getEjbClassName(), 92 false, 93 getVerifierContext().getClassLoader()); 94 for (Method method : beanClass.getMethods()) { 95 96 if (method.getName().equals(remoteMethod.getName()) && 97 !RmiIIOPUtils.isValidRmiIIOPParameters(method.getParameterTypes())) { 98 addErrorDetails(result, compName); 100 result.failed(smh.getLocalString 101 (getClass().getName() + ".failed", 102 "Error: business method [ {0} ] was found, but " + 103 "business method has invalid parameter values. " + 104 "Business method parameter types must be valid " + 105 "types for RMI-IIOP.", 106 new Object [] {method.getName()})); 107 } 108 } 109 } 110 111 } catch (ClassNotFoundException e) { 112 Verifier.debug(e); 113 addErrorDetails(result, compName); 114 result.failed(smh.getLocalString 115 (getClass().getName() + ".failedException", 116 "Error: Remote interface [ {0} ] or bean class [ {1} ] does " + 117 "not exist or is not loadable within bean [ {2} ].", 118 new Object [] {descriptor.getRemoteClassName(), 119 descriptor.getEjbClassName(), 120 descriptor.getName()})); 121 } 122 } 123 } 124 | Popular Tags |