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.ConfigException; 48 import com.sun.enterprise.config.serverbeans.*; 49 import com.sun.enterprise.config.ConfigContextEvent; 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 LifecycleModuleTest extends ServerXmlTest implements ServerCheck { 60 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 62 63 public LifecycleModuleTest() { 64 } 65 66 public Result check(ConfigContext context) { 68 Result result; 69 result = super.getInitializedResult(); 70 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 LifecycleModule life = (LifecycleModule)value; 111 112 String id = life.getName(); 114 if(StaticTest.checkObjectName(id, result)) 115 result.passed("Valid Object Name"); 116 else { 117 result.failed("LifeCycle Module Name Invalid "); 118 return result; 119 } 120 122 String loadOrder = life.getLoadOrder(); 123 124 try { 125 if(loadOrder!=null) { 128 if(Integer.parseInt(loadOrder) < 0) { 130 result.failed("Load Order Must be positive number"); 131 return result; 132 } 133 } 134 result.passed("Test passed ******"); 135 } 136 catch(NumberFormatException e) { 137 result.failed("Load Order for LifeCycleModule must be integer value"); 138 } 139 return result; 140 } 141 142 public Result testSave(String name, String value) { 143 Result result = new Result(); 144 result.passed(" ***"); 145 if(name.equals("load-order")){ 146 try { 147 if(value!=null) { 148 if(Integer.parseInt(value) < 0) { 150 result.failed("Load Order Must be positive number"); 151 return result; 152 } 153 } 154 result.passed("Test passed ******"); 155 }catch(NumberFormatException e) { 156 result.failed("Load Order for LifeCycleModule must be integer value"); 157 } 158 } 159 return result; 160 } 161 } 162 | Popular Tags |