1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 37 38 import com.sun.enterprise.config.serverbeans.Server; 41 import com.sun.enterprise.config.serverbeans.*; 42 import com.sun.enterprise.config.ConfigContext; 43 import com.sun.enterprise.config.ConfigException; 44 import com.sun.enterprise.config.serverbeans.*; 45 import com.sun.enterprise.config.ConfigContextEvent; 46 47 import com.sun.enterprise.admin.verifier.*; 48 import java.util.logging.Logger ; 50 import java.util.logging.Level ; 51 import com.sun.logging.LogDomains; 52 53 54 55 public class MdbContainerTest extends ServerXmlTest implements ServerCheck { 56 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 58 59 public MdbContainerTest() { 60 } 61 62 public Result check(ConfigContext context) { 64 Result result; 65 result = super.getInitializedResult(); 66 111 115 return result; 116 } 117 118 public Result check(ConfigContextEvent ccce) { 120 Object value = ccce.getObject(); 121 ConfigContext context = ccce.getConfigContext(); 122 Result result = new Result(); 123 result.passed("Passed ** "); 124 String beanName = ccce.getBeanName(); 125 if(beanName!=null) { 126 String name = ccce.getName(); 127 if(name != null && value != null) 128 result = validateAttribute(name, (String )value); 129 return result; 130 } 131 132 return result; 133 } 134 135 public Result validateAttribute(String name, String value) { 136 Result result = new Result(); 137 boolean isFailed = false; 138 result.passed("Passed **"); 139 if(name.equals(ServerTags.STEADY_POOL_SIZE)) { 140 try { 141 if(Integer.parseInt(value) < 0) { 142 result.failed(smh.getLocalString(getClass().getName()+".steadyPoolNegative","Steady Pool size cannot be negative number")); 143 isFailed = true; 144 } 145 else 146 result.passed("Passed ***"); 147 } catch(NumberFormatException e) { 148 result.failed(smh.getLocalString(getClass().getName()+".steadyPoolInvalid","Steady Pool Size : invalid number")); 149 isFailed = true; 150 } 151 } 152 if(name.equals(ServerTags.MAX_POOL_SIZE)) { 153 try { 154 if(Integer.parseInt(value) < 0) { 155 result.failed(smh.getLocalString(getClass().getName()+".maxPoolNegative","Max Pool size cannot be negative number")); 156 isFailed = true; 157 } 158 else 159 result.passed("Passed ***"); 160 } catch(NumberFormatException e) { 161 result.failed(smh.getLocalString(getClass().getName()+".maxPoolInvalid","Max Pool Size : invalid number")); 162 isFailed = true; 163 } 164 } 165 if(name.equals(ServerTags.POOL_RESIZE_QUANTITY)){ 166 try { 167 if(Integer.parseInt(value) < 0) { 168 result.failed(smh.getLocalString(getClass().getName()+".resizeQtyNegative","Pool Resize Qty cannot be negative number")); 169 isFailed = true; 170 } 171 else 172 result.passed("Passed ***"); 173 } catch(NumberFormatException e) { 174 result.failed(smh.getLocalString(getClass().getName()+".resizeQtyInvalid","Pool Resize Qty : invalid number")); 175 isFailed = true; 176 } 177 } 178 if(name.equals(ServerTags.IDLE_TIMEOUT_IN_SECONDS)) { 179 try { 180 if(Integer.parseInt(value) < 0) { 181 result.failed(smh.getLocalString(getClass().getName()+".idleTimeoutNegative","Idle Timeout in Seconds cannot be negative number")); 182 isFailed = true; 183 } 184 else 185 result.passed("Passed ***"); 186 } catch(NumberFormatException e) { 187 result.failed(smh.getLocalString(getClass().getName()+".idleTimeoutInvalid","Idle Timeout in Seconds : invalid number")); 188 isFailed = true; 189 } 190 } 191 if(isFailed) 192 result.setStatus(Result.FAILED); 193 return result; 194 } 195 } 196 | Popular Tags |