FileDocCategorySizeDatePackage
EjbClassExist.javaAPI DocGlassfish v2 API4733Fri May 04 22:33:32 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.beanclass

EjbClassExist

public class EjbClassExist extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Bean class test. Verify that the bean class exist and is loadable.

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Bean class test. Verify that the bean class exist and is loadable.

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	// verify that the bean class exist and is loadable
	try {
        Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
	    result.addGoodDetails(smh.getLocalString
				  ("tests.componentNameConstructor",
				   "For [ {0} ]",
				   new Object[] {compName.toString()}));
	    result.passed(smh.getLocalString
			  (getClass().getName() + ".passed",
			   "Bean class [ {0} ] exist and is loadable.",
			   new Object[] {descriptor.getEjbClassName()}));

	} catch (NoClassDefFoundError e) {
//	    e.printStackTrace();
	    logger.log(Level.FINE, "Can't find class " + e.getMessage());
	    result.addErrorDetails(smh.getLocalString
				   ("tests.componentNameConstructor",
				    "For [ {0} ]",
				    new Object[] {compName.toString()}));
	    result.failed(smh.getLocalString
			  (getClass().getName() + ".failed",
			   "Error: Bean class [ {0} ] does not exist or is not loadable.",
			   new Object[] {descriptor.getEjbClassName()}));
	} catch (ClassNotFoundException e) {
	    Verifier.debug(e);
	    result.addErrorDetails(smh.getLocalString
				   ("tests.componentNameConstructor",
				    "For [ {0} ]",
				    new Object[] {compName.toString()}));
	    result.failed(smh.getLocalString
			  (getClass().getName() + ".failed",
			   "Error: Bean class [ {0} ] does not exist or is not loadable.",
			   new Object[] {descriptor.getEjbClassName()}));
	} catch (Exception e) {
//	    e.printStackTrace();
	    result.addErrorDetails(smh.getLocalString
				   ("tests.componentNameConstructor",
				    "For [ {0} ]",
				    new Object[] {compName.toString()}));
	    result.failed(smh.getLocalString
			  (getClass().getName() + ".failed",
			   "Error: Bean class [ {0} ] does not exist or is not loadable.",
			   new Object[] {descriptor.getEjbClassName()}));
	}
	return result;