1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.messagebean; 25 26 import java.lang.reflect.Method ; 27 import java.lang.reflect.Modifier ; 28 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 29 import com.sun.enterprise.tools.verifier.Result; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 32 33 40 public class EjbCreateModifiers extends MessageBeanTest { 41 42 47 protected String getMethodName() { 48 return "ejbCreate"; 49 } 50 51 59 public Result check(EjbMessageBeanDescriptor descriptor) { 60 61 Result result = getInitializedResult(); 62 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 63 Class mbc = loadMessageBeanClass(descriptor, result); 64 if (mbc!=null) { 65 Method m = getMethod(mbc, getMethodName(),null); 66 if (m!=null) { 67 int modifiers = m.getModifiers(); 68 if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers) && !Modifier.isFinal(modifiers)) { 69 result.addGoodDetails(smh.getLocalString 70 ("tests.componentNameConstructor", 71 "For [ {0} ]", 72 new Object [] {compName.toString()})); 73 74 result.passed(smh.getLocalString 75 ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.EjbCreateModifiers.passed", 76 "Message-Drive bean [ {0} ] provide an {1} implementation declared public and not static or final", 77 new Object [] {(descriptor).getEjbClassName(), getMethodName()})); 78 } else { 79 result.addErrorDetails(smh.getLocalString 80 ("tests.componentNameConstructor", 81 "For [ {0} ]", 82 new Object [] {compName.toString()})); 83 result.failed(smh.getLocalString 84 ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.EjbCreateModifiers.failed", 85 "Error: Message-Drive bean [ {0} ] {1} implementation is either not public or is static or final", 86 new Object [] {(descriptor).getEjbClassName(), getMethodName()})); 87 } 88 } else { 89 result.addErrorDetails(smh.getLocalString 90 ("tests.componentNameConstructor", 91 "For [ {0} ]", 92 new Object [] {compName.toString()})); 93 result.failed(smh.getLocalString 94 ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.EjbCreateExists.failed", 95 "Error: Message-Drive bean [ {0} ] does not implement an {1} with no arguments", 96 new Object [] {(descriptor).getEjbClassName(), getMethodName()})); 97 } 98 } 99 return result; 100 } 101 } 102 | Popular Tags |