1 23 24 25 package com.sun.enterprise.tools.verifier.tests.ejb.messagebean; 26 27 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 28 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 29 import com.sun.enterprise.deployment.EjbDescriptor; 30 import com.sun.enterprise.tools.verifier.Result; 31 import com.sun.enterprise.tools.verifier.*; 32 import java.lang.ClassLoader ; 33 import com.sun.enterprise.tools.verifier.tests.*; 34 35 41 abstract public class MessageBeanTest extends EjbTest { 42 43 51 abstract public Result check(EjbMessageBeanDescriptor descriptor); 52 ComponentNameConstructor compName = null; 53 54 63 public Result check(EjbDescriptor descriptor) { 64 65 if (descriptor instanceof EjbMessageBeanDescriptor) { 66 return check((EjbMessageBeanDescriptor) descriptor); 67 } else { 68 Result result = getInitializedResult(); 69 compName = getVerifierContext().getComponentNameConstructor(); 70 result.addNaDetails(smh.getLocalString 71 ("tests.componentNameConstructor", 72 "For [ {0} ]", 73 new Object [] {compName.toString()})); 74 result.notApplicable(smh.getLocalString 75 ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.MessageBeanTest.notApplicable", 76 "Test apply only to message-driven Bean components")); 77 return result; 78 } 79 } 80 81 90 protected Class loadMessageBeanClass(EjbMessageBeanDescriptor descriptor, Result result) { 91 try { 92 compName = getVerifierContext().getComponentNameConstructor(); 93 Context context = getVerifierContext(); 94 ClassLoader jcl = context.getClassLoader(); 95 return Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader()); 96 } catch (ClassNotFoundException e) { 97 Verifier.debug(e); 98 result.addErrorDetails(smh.getLocalString 99 ("tests.componentNameConstructor", 100 "For [ {0} ]", 101 new Object [] {compName.toString()})); 102 result.failed(smh.getLocalString 103 ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.classnotfoundexception", 104 "Cannot load declared message-driven bean component [ {0} ]")); 105 return null; 106 } 107 } 108 } 109 | Popular Tags |