FileDocCategorySizeDatePackage
HomeInterfaceClassExist.javaAPI DocGlassfish v2 API5803Fri May 04 22:33:52 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.homeintf

HomeInterfaceClassExist

public abstract class HomeInterfaceClassExist extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
Home Interface test. Verify that the bean home interface class exist and is loadable.
author
Sheetal Vartak

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(EjbDescriptor descriptor)
Home Interface test. Verify that the bean home interface 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();
        
	if (!(descriptor instanceof EjbSessionDescriptor) &&
	    !(descriptor instanceof EjbEntityDescriptor)) { 
	    result.addNaDetails(smh.getLocalString
				("tests.componentNameConstructor",
				 "For [ {0} ]",
				 new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
				 ("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable1",
				  "Test apply only to session or entity beans."));
	    return result;                
        }

	if(getHomeInterfaceName(descriptor) == null || "".equals(getHomeInterfaceName(descriptor))){
            result.addNaDetails(smh.getLocalString
                        ("tests.componentNameConstructor", "For [ {0} ]",
                         new Object[] {compName.toString()}));
            result.notApplicable(smh.getLocalString
                       ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
                        "Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
                                          new Object[] {descriptor.getEjbClassName()}));

	    return result;
	}

	// verify that the home interface class exist and is loadable
	try {
	    Context context = getVerifierContext();
	    ClassLoader jcl = context.getClassLoader();
	    Class c = Class.forName(getClassName(descriptor), false, jcl);
	    if (c != null) {
	        result.addGoodDetails(smh.getLocalString
				      ("tests.componentNameConstructor",
				       "For [ {0} ]",
				       new Object[] {compName.toString()}));	
		result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			       "Home interface [ {0} ] exist and is loadable.",
			       new Object[] {getClassName(descriptor)}));
	    } else {
	        result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.failed(smh.getLocalString
			      (getClass().getName() + ".failed",
			       "Error: Home interface [ {0} ] does not exist or is not loadable.",
			       new Object[] {getClassName(descriptor)}));
	    }
	} 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: Home interface [ {0} ] does not exist or is not loadable.",
			   new Object[] {getClassName(descriptor)}));
	}
	return result;
    
private java.lang.StringgetClassName(EjbDescriptor descriptor)

	return getHomeInterfaceName(descriptor);
    
protected abstract java.lang.StringgetHomeInterfaceName(EjbDescriptor descriptor)
Method tells the name of the home interface class that called this test