FileDocCategorySizeDatePackage
AroundInvokeNotBusinessMethod.javaAPI DocGlassfish v2 API4273Fri May 04 22:33:34 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.ejb30

AroundInvokeNotBusinessMethod

public class AroundInvokeNotBusinessMethod extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
An AroundInvoke method must not be a business method.
author
Vikas Awasthi

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)

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

        if(descriptor.hasAroundInvokeMethod()) {
            Set<MethodDescriptor> businessMethods = descriptor.getMethodDescriptors();
            Set<LifecycleCallbackDescriptor> aiDescriptors = 
                                        descriptor.getAroundInvokeDescriptors();
            
            for (LifecycleCallbackDescriptor aiDesc : aiDescriptors) {
                try {
                    Method interceptorMethod = aiDesc.getLifecycleCallbackMethodObject(cl);
                    MethodDescriptor interceptorMD = new MethodDescriptor(interceptorMethod);
                    if(businessMethods.contains(interceptorMD)) {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString
                                (getClass().getName() + ".failed",
                                "AroundInvoke method [ {0} ] is a business method.",
                                new Object[] {interceptorMethod}));
                    }
                } catch (Exception e) {}// will be caught in other tests
            }
        }

        if(result.getStatus()!=Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "Valid Interceptor methods."));
        }
        return result;