1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 37 38 import java.net.*; 39 40 import com.sun.enterprise.config.serverbeans.Server; 43 import com.sun.enterprise.config.serverbeans.*; 44 import com.sun.enterprise.config.serverbeans.Resources; 45 import com.sun.enterprise.config.serverbeans.Applications; 46 import com.sun.enterprise.config.ConfigContext; 47 import com.sun.enterprise.config.ConfigContextEvent; 48 import com.sun.enterprise.config.ConfigException; 49 import com.sun.enterprise.config.serverbeans.*; 50 51 import com.sun.enterprise.admin.verifier.*; 52 import java.util.logging.Logger ; 54 import java.util.logging.Level ; 55 import com.sun.logging.LogDomains; 56 57 58 59 public class MailResourceTest extends ServerXmlTest implements ServerCheck { 60 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 62 63 public MailResourceTest() { 64 } 65 66 public Result check(ConfigContext context) 68 { 69 Result result; 70 result = super.getInitializedResult(); 71 93 97 return result; 98 } 99 100 public Result check(ConfigContextEvent ccce) { 102 Result result = new Result(); 103 Object value = ccce.getObject(); 104 String beanName = ccce.getBeanName(); 105 if(beanName!=null) { 106 String name = ccce.getName(); 107 return testSave(name,(String )value); 108 } 109 110 MailResource res = (MailResource)value; 111 String ip = res.getHost(); 112 113 String id = res.getJndiName(); 115 116 if(StaticTest.checkObjectName(id, result)) 117 result.passed("Valid Object Name"); 118 else { 119 result.failed("Mail Resource Jndi-Name Invalid "); 120 return result; 121 } 122 try{ 124 InetAddress.getByName(ip).getHostName(); 125 result.passed("Valid Mail Resource IP"); 126 }catch(UnknownHostException e){ 127 result.failed("Host name not resolvable - " + ip); 128 return result; 129 } 130 return result; 131 } 132 133 public Result testSave(String name, String value) { 134 Result result = new Result(); 135 result.passed("Passed **"); 136 if(name.equals(ServerTags.HOST)){ 137 try{ 138 InetAddress.getByName(value).getHostName(); 139 result.passed("Valid Mail Resource IP"); 140 }catch(UnknownHostException e){ 141 result.failed("Host name not resolvable - " + value); 142 } 143 } 144 return result; 145 } 146 147 } 148 | Popular Tags |