FileDocCategorySizeDatePackage
WebModuleTest.javaAPI DocGlassfish v2 API6971Fri May 04 22:34:12 BST 2007com.sun.enterprise.admin.verifier.tests

WebModuleTest

public class WebModuleTest extends ServerXmlTest implements ServerCheck
PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms. Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All rights reserved.

Fields Summary
static Logger
_logger
Constructors Summary
public WebModuleTest()

    
      
    
Methods Summary
public Resultcheck(com.sun.enterprise.config.ConfigContext context)

                Result result;
                result = super.getInitializedResult();
                // 8.0 XML Verifier
                /*try {
                    Server server = (Server)context.getRootConfigBean();
                    result.passed("Test Passed : ");
                    Applications app = server.getApplications(); 
                    WebModule[]  web = app.getWebModule();
                    File f;
                    for(int i=0;i<web.length;i++) {
                        f = new File(web[i].getLocation());
                        try {
                            if(f.exists())
                                 result.passed("Test Passed ****");
                            else
                                 result.failed("Web Module location directory for " + web[i].getName() +" is not valid");
                        }catch(SecurityException e) {
                            result.failed("Security Manager Exists, not possible to access Web Module location");
                        }
                    }
                }
                catch(Exception ex){
                    //<addition author="irfan@sun.com" [bug/rfe]-id="logging" >
                    /*result.failed("Test Failed **** ");*/
                    /*_logger.log(Level.FINE, "serverxmlverifier.exception", ex);
                    result.failed("Exception : " + ex.getMessage());
                    //</addition>
                }*/
                return result;
    
public Resultcheck(com.sun.enterprise.config.ConfigContextEvent ccce)

                Object value = ccce.getObject();
                Result result = new Result();
                String beanName = ccce.getBeanName();
                if(beanName!=null) {
                    String name = ccce.getName();
                    return testSave(name,(String)value);
                }
                WebModule web = (WebModule)value;
                // check if jndi-name is valid object name Bug : 4698687 : start
                String id = web.getName();
                if(StaticTest.checkObjectName(id, result)) 
                    result.passed("Valid Object Name");
                else {
                    result.failed("Web Module Name Invalid ");
                    return result;
                }
                // End Bug : 4698687
                
                String location = web.getLocation();
                File f = new File(location);
                try {
                    if(f.exists())
                         result.passed("Test Passed ****");
                    else
                         result.failed("Web Module location directory is not valid");
                }catch(SecurityException e) {
                    result.failed("Security Manager Exists, not possible to access Web Module location");
                }
                return result;
    
public ResulttestSave(java.lang.String name, java.lang.String value)

          Result result = new Result();
          result.passed("Passed **");
	  if(name.equals(ServerTags.LOCATION)) {
              File f = new File(value);
              try {
                  if(f.exists())
                       result.passed("Test Passed ****");
                  else 
                       result.failed("Web Module location directory is not valid");
              }catch(SecurityException e) {
                  result.failed("Security Manager Exists, not possible to access Web Module location");          
              }  
              return result;
         }
         return result;