FileDocCategorySizeDatePackage
AppWebContext.javaAPI DocGlassfish v2 API3890Fri May 04 22:33:28 BST 2007com.sun.enterprise.tools.verifier.tests.app

AppWebContext

public class AppWebContext extends com.sun.enterprise.tools.verifier.tests.app.ApplicationTest implements AppCheck
All web modules in the application have a non-blank context-root

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(Application descriptor)
All web modules in the application have a non-blank context-root

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


	Result result = getInitializedResult();

  
	if (descriptor.getWebBundleDescriptors().size() > 0) {
	    boolean oneWarning = false;
	    for (Iterator itr = descriptor.getWebBundleDescriptors().iterator(); itr.hasNext();) {
		WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
		if (wbd.getContextRoot().equals("")) {
		    // fail test can't be blank , 
		    if (!oneWarning) {
			oneWarning =true;
		    }
		    result.addWarningDetails
			(smh.getLocalString
			 (getClass().getName() + ".warning",
			  "Warning: [ {0} ] has blank context root defined within application [ {1} ]",
			  new Object[] {wbd.getName(), descriptor.getName()}));
		} else {
		    result.addGoodDetails
			(smh.getLocalString
			 (getClass().getName() + ".passed",
			  "[ {0} ] has context root defined as [ {1} ] within application[ {2} ].",
			  new Object[] {wbd.getName(), wbd.getContextRoot(), descriptor.getName()}));
		}
	    }

	    if (oneWarning) {
		result.setStatus(Result.WARNING);
	    } else {
		result.setStatus(Result.PASSED);
	    }
	} else {
	    result.notApplicable(smh.getLocalString
				 (getClass().getName() + ".notApplicable",
				  "There are no web components in application [ {0} ]",
				  new Object[] {descriptor.getName()}));
	}
  
	return result;