FileDocCategorySizeDatePackage
SelectMethodExposition.javaAPI DocGlassfish v2 API6416Fri May 04 22:33:40 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2

SelectMethodExposition

public class SelectMethodExposition extends SelectMethodTest
Select methods must not be exposed through the bean home or remote interface
author
Jerome Dochez
version

Fields Summary
ComponentNameConstructor
compName

run an individual test against a declared ejbSelect method

Constructors Summary
Methods Summary
private booleancommonToBothInterfaces(java.lang.String home, java.lang.String remote, EjbDescriptor descriptor, com.sun.enterprise.tools.verifier.Result result, java.lang.reflect.Method m)
This method is responsible for the logic of the test. It is called for both local and remote interfaces.

param
descriptor the Enterprise Java Bean deployment descriptor
param
ejbHome for the Home interface of the Ejb.
param
result Result of the test
param
remote Remote/Local interface
param
m Method
return
boolean the results for this assertion i.e if a test has failed or not

	try {
            // we must not find this method exposed in the home or remote interface
	    Context context = getVerifierContext();
	    ClassLoader jcl = context.getClassLoader();
            Method m1 = getMethod(Class.forName(home, false,
                                 getVerifierContext().getClassLoader()),m.getName(), m.getParameterTypes());
            Method m2 = getMethod(Class.forName(remote, false,
                                 getVerifierContext().getClassLoader()), m.getName(), m.getParameterTypes());
            if (m1 == null && m2 == null) {
		result.addGoodDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.addGoodDetails(smh.getLocalString
			  ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodExposition.passed",
			   "[ {0} ] is not declared in the home or remote interface",
			   new Object[] {m.getName()}));
                return true;
            } else {
		result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.addErrorDetails(smh.getLocalString
                    ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodExposition.failed",
                    "Error : [ {0} ] is declared in the home or remote interface",
                    new Object[] {m.getName()}));
                return false;
            }
        } catch (ClassNotFoundException e) {
	    result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
	    result.addErrorDetails(smh.getLocalString
		     ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodExposition.failedException",
		      "Error: home or remote interface not found.",
		      new Object[] {}));
            Verifier.debug(e);
            return false;
        }
    
protected booleanrunIndividualSelectTest(java.lang.reflect.Method m, EjbCMPEntityDescriptor descriptor, com.sun.enterprise.tools.verifier.Result result)


            
        boolean allIsWell = true;
	compName = getVerifierContext().getComponentNameConstructor();
	//  String methodReturnType = m.getReturnType().getName();
    	if(descriptor.getRemoteClassName() != null && !"".equals(descriptor.getRemoteClassName()) &&
	   descriptor.getHomeClassName() != null && !"".equals(descriptor.getHomeClassName()))
	    allIsWell =  commonToBothInterfaces(descriptor.getHomeClassName(),descriptor.getRemoteClassName(),descriptor, result, m);
	if(allIsWell == true) {
	    if(descriptor.getLocalClassName() != null && !"".equals(descriptor.getLocalClassName()) &&
	       descriptor.getLocalHomeClassName() != null && !"".equals(descriptor.getLocalHomeClassName()))
		allIsWell =  commonToBothInterfaces(descriptor.getLocalHomeClassName(),descriptor.getLocalClassName(),descriptor, result, m);
	}
	return allIsWell;