1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 import java.net.*; 35 36 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 public class JmsServiceTest extends ServerXmlTest implements ServerCheck { 59 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 61 62 public JmsServiceTest() { 63 } 64 65 public Result check(ConfigContext context) 67 { 68 Result result; 69 result = super.getInitializedResult(); 70 105 return result; 107 } 108 109 public Result check(ConfigContextEvent ccce) { 111 Result result = new Result(); 112 Object value = ccce.getObject(); 113 String beanName = ccce.getBeanName(); 114 if(beanName!=null) { 115 String name = ccce.getName(); 116 return testSave(name, (String ) value); 117 } 118 119 JmsHost jms = (JmsHost) value; 123 String httpPort = jms.getPort(); 125 try { 126 if(StaticTest.isPortValid(Integer.parseInt(httpPort))) 127 result.passed("Valid Port"); 128 else 129 result.failed("Invalid JMSService Port : " + httpPort); 130 } 131 catch(NumberFormatException e) { 132 result.failed("Invalid JMSService Port Number : " + httpPort); 133 } 134 return result; 135 } 136 137 public Result testSave(String name, String value) { 138 Result result = new Result(); 139 result.passed("Passed"); 140 if(name.equals(ServerTags.PORT)) { 141 try { 142 if(StaticTest.isPortValid(Integer.parseInt(value))) 143 result.passed("Valid Port"); 144 else 145 result.failed("Invalid Port"); 146 } catch(NumberFormatException e) { 147 result.failed("Bad Number"); 148 } 149 } 150 if(name.equals(ServerTags.INIT_TIMEOUT_IN_SECONDS)) { 153 try { 154 if(Integer.parseInt(value) < 0) 155 result.failed(smh.getLocalString(getClass().getName()+".initTimeoutNegative","Init Timeout cannot be negative number")); 156 else 157 result.passed("Passed **"); 158 } catch (NumberFormatException e) { 159 result.failed(smh.getLocalString(getClass().getName()+".initTimeoutInvalid","Init Timeout : invalid number")); 160 } 161 } 162 return result; 163 } 164 } 165 | Popular Tags |