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

ParamValue

public class ParamValue extends WebTest implements WebCheck
Param value should not be empty string
author
Arun Jain

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebBundleDescriptor descriptor)
Param value should not be empty string

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


        Set contextParameters;
        Iterator itr;
        String epValue;
	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        EnvironmentProperty ep;
        boolean passed = true;
        boolean oneFailed = false;
        boolean notApp = false;
        
	if (!descriptor.getContextParametersSet().isEmpty()) {
            
	    // get the context parameters
	    contextParameters = descriptor.getContextParametersSet();
	    itr = contextParameters.iterator();
	    // test the environment property
	    while (itr.hasNext()) {
		ep = (EnvironmentProperty)itr.next();
		epValue = ep.getValue();
                if ( epValue.length() != 0) {
		    result.addGoodDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
                    result.addGoodDetails(smh.getLocalString
                                          (getClass().getName() + ".passed",
                                           "Param named/value exists for in the web archive [ {0} ].",
                                           new Object[] {descriptor.getName()}));                              
                } else {
                    oneFailed = true;
		    result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
                    result.addErrorDetails(smh.getLocalString
                                           (getClass().getName() + ".failed",
                                            "Error: Param name/value should not be empty strings"));
                    
                }
            } 
            
        } else {
            notApp = true;
	    result.addNaDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
                                 (getClass().getName() + ".notApplicable",
                                  "There are no context parameters within the web archive [ {0} ]",
                                  new Object[] {descriptor.getName()}));
        }
        if (oneFailed) {
            result.setStatus(Result.FAILED);
        } else if (notApp) {
            result.setStatus(Result.NOT_APPLICABLE);
        } else {
            result.setStatus(Result.PASSED);
        }
	return result;