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

InterceptorMethodTest

public abstract class InterceptorMethodTest extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
Base class for all interceptor method tests.
author
Vikas Awasthi

Fields Summary
com.sun.enterprise.tools.verifier.Result
result
com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor
compName
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)

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

        testInterceptorMethods(
                descriptor.getAroundInvokeDescriptors(), "AroundInvoke", true);
        testInterceptorMethods(
                descriptor.getPreDestroyDescriptors(), "PreDestroy", true);
        testInterceptorMethods(
                descriptor.getPostConstructDescriptors(), "PostConstruct", true);

        if(descriptor instanceof EjbSessionDescriptor) {
            EjbSessionDescriptor sessionDescriptor = (EjbSessionDescriptor)descriptor;
            testInterceptorMethods(
                    sessionDescriptor.getPrePassivateDescriptors(), "PrePassivate", true);
            testInterceptorMethods(
                    sessionDescriptor.getPostActivateDescriptors(), "PostActivate", true);
        }

        descriptor.getInterceptorClasses();
        for (EjbInterceptor interceptor : descriptor.getInterceptorClasses()) {
            testInterceptorMethods(
                    interceptor.getAroundInvokeDescriptors(), "AroundInvoke", false);
            testInterceptorMethods(
                    interceptor.getPreDestroyDescriptors(), "PreDestroy", false);
            testInterceptorMethods(
                    interceptor.getPostConstructDescriptors(), "PostConstruct", false);
            testInterceptorMethods(
                    interceptor.getCallbackDescriptors(
                            LifecycleCallbackDescriptor.CallbackType.PRE_PASSIVATE), "PrePassivate", false);
            testInterceptorMethods(
                    interceptor.getCallbackDescriptors(
                            LifecycleCallbackDescriptor.CallbackType.POST_ACTIVATE), "PostActivate", false);
        }

        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            ("com.sun.enterprise.tools.verifier.tests.ejb.ejb30.InterceptorMethodTest.passed",
                            "Valid Interceptor methods."));
        }
        return result;
    
protected voidlogFailure(java.lang.String methodName, java.lang.reflect.Method method)

        result.getFaultLocation().setFaultyClassAndMethod(method);
        addErrorDetails(result, compName);
        result.failed(smh.getLocalString
                        ("com.sun.enterprise.tools.verifier.tests.ejb.ejb30.InterceptorMethodTest.failed",
                        "Wrong {0} interceptor method [ {1} ]",
                        new Object[] {methodName, method}));
    
abstract voidtestInterceptorMethods(java.util.Set callbackDescs, java.lang.String callbackMethodName, java.lang.Boolean isBeanMethod)