1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 37 38 import java.net.*; 39 import java.io.File ; 40 import java.io.FileNotFoundException ; 41 42 import com.sun.enterprise.config.serverbeans.Server; 45 import com.sun.enterprise.config.serverbeans.*; 46 import com.sun.enterprise.config.serverbeans.Resources; 47 import com.sun.enterprise.config.serverbeans.Applications; 48 import com.sun.enterprise.config.ConfigContext; 49 import com.sun.enterprise.config.ConfigException; 50 import com.sun.enterprise.config.serverbeans.*; 51 import com.sun.enterprise.config.ConfigContextEvent; 52 53 import com.sun.enterprise.admin.verifier.*; 54 import java.util.logging.Logger ; 56 import java.util.logging.Level ; 57 import com.sun.logging.LogDomains; 58 59 60 61 public class WebModuleTest extends ServerXmlTest implements ServerCheck { 62 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 64 65 public WebModuleTest() { 66 } 67 68 public Result check(ConfigContext context) { 70 Result result; 71 result = super.getInitializedResult(); 72 94 98 return result; 99 } 100 101 public Result check(ConfigContextEvent ccce) { 103 Object value = ccce.getObject(); 104 Result result = new Result(); 105 String beanName = ccce.getBeanName(); 106 if(beanName!=null) { 107 String name = ccce.getName(); 108 return testSave(name,(String )value); 109 } 110 WebModule web = (WebModule)value; 111 String id = web.getName(); 113 if(StaticTest.checkObjectName(id, result)) 114 result.passed("Valid Object Name"); 115 else { 116 result.failed("Web Module Name Invalid "); 117 return result; 118 } 119 121 String location = web.getLocation(); 122 File f = new File (location); 123 try { 124 if(f.exists()) 125 result.passed("Test Passed ****"); 126 else 127 result.failed("Web Module location directory is not valid"); 128 }catch(SecurityException e) { 129 result.failed("Security Manager Exists, not possible to access Web Module location"); 130 } 131 return result; 132 } 133 134 public Result testSave(String name,String value){ 135 Result result = new Result(); 136 result.passed("Passed **"); 137 if(name.equals(ServerTags.LOCATION)) { 138 File f = new File (value); 139 try { 140 if(f.exists()) 141 result.passed("Test Passed ****"); 142 else 143 result.failed("Web Module location directory is not valid"); 144 }catch(SecurityException e) { 145 result.failed("Security Manager Exists, not possible to access Web Module location"); 146 } 147 return result; 148 } 149 return result; 150 } 151 152 } 153 | Popular Tags |