FileDocCategorySizeDatePackage
FilterClass.javaAPI DocGlassfish v2 API4547Fri May 04 22:34:10 BST 2007com.sun.enterprise.tools.verifier.tests.web

FilterClass

public abstract class FilterClass extends WebTest implements WebCheck
Super class for all filter tests.
author
Jerome Dochez
version
1.0

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.WebBundleDescriptor descriptor)
iterates over all declared filter in the archive file and delegates actual test on individual filter class to runIndividualFilterTest

param
descriptor the Web deployment descriptor
return
Result the results for this assertion

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

        Enumeration filterEnum = descriptor.getServletFilterDescriptors().elements();
	if (filterEnum.hasMoreElements()) {
            boolean oneFailed = false;
	    // test the filters in this .war
            result = loadWarFile(descriptor);
	    while (filterEnum.hasMoreElements()) {
		ServletFilterDescriptor filter = (ServletFilterDescriptor) filterEnum.nextElement();
		Class filterClass = loadClass(result, filter.getClassName());
                                
                if (!runIndividualFilterTest(result, filterClass)) 
                    oneFailed=true;                
 	    }
	    if (oneFailed) {
		result.setStatus(Result.FAILED);
	    } else {
		result.setStatus(Result.PASSED);
	    }
	} else {
            result = getInitializedResult();
            result.setStatus(Result.NOT_APPLICABLE);
	    result.addNaDetails(smh.getLocalString
					   ("tests.componentNameConstructor",
					    "For [ {0} ]",
					    new Object[] {compName.toString()}));

	    result.notApplicable(smh.getLocalString
                ("com.sun.enterprise.tools.verifier.tests.web.FilterClass" + ".notApplicable",
		 "There are no filter components within the web archive [ {0} ]",
		 new Object[] {descriptor.getName()}));
	}

	return result;
    
protected abstract booleanrunIndividualFilterTest(com.sun.enterprise.tools.verifier.Result result, java.lang.Class listenerClass)

Run the verifier test against a declared individual filter class

param
result is used to put the test results in
param
filterClass is the individual filter class object to test
return
true if the test pass