1 23 package com.sun.enterprise.tools.verifier.tests.ejb.messagebean; 24 25 import com.sun.enterprise.tools.verifier.Result; 26 import com.sun.enterprise.tools.verifier.Verifier; 27 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 28 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 29 30 import java.lang.reflect.Method ; 31 32 36 public class RemoteExceptionNotThrown extends MessageBeanTest { 37 38 public Result check(EjbMessageBeanDescriptor descriptor) { 39 Result result = getInitializedResult(); 40 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 41 ClassLoader cl = getVerifierContext().getClassLoader(); 42 try { 43 Method [] methods = descriptor.getMessageListenerInterfaceMethods(cl); 44 for (int i = 0; i < methods.length; i++) { 45 if(containsRemote(methods[i].getExceptionTypes())) { 46 addErrorDetails(result, compName); 47 result.failed(smh.getLocalString 48 (getClass().getName()+".failed", 49 "Method [ {0} ] throws RemoteException", 50 new Object [] {methods[i]})); 51 } 52 } 53 } catch (NoSuchMethodException e) { 54 Verifier.debug(e); 55 addErrorDetails(result, compName); 56 result.failed(smh.getLocalString 57 (getClass().getName()+".failed1", 58 "[ {0} ]", new Object []{e.getMessage()})); 59 } 60 61 if(result.getStatus() != Result.FAILED) { 62 addGoodDetails(result, compName); 63 result.passed(smh.getLocalString 64 (getClass().getName() + ".passed", 65 "Valid message listener method(s).")); 66 } 67 return result; 68 } 69 70 71 private boolean containsRemote(Class [] exceptions) { 72 for (int i = 0; i < exceptions.length; i++) 73 if(exceptions[i].getName().equals("java.rmi.RemoteException")) 74 return true; 75 76 return false; 77 } 78 } 79 | Popular Tags |