1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.runtime.beancache; 25 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.Verifier; 28 import com.sun.enterprise.tools.verifier.Result; 29 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 30 31 44 45 public class ASEjbBCCacheIdleTimeout extends ASEjbBeanCache 46 { 47 48 public Result check(EjbDescriptor descriptor) 49 { 50 Result result = getInitializedResult(); 51 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 52 String beanCache = null; 53 String idleTimeout = null; 54 try{ 55 beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache"); 56 if(beanCache!=null) 57 { 58 try{ 59 idleTimeout = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/cache-idle-timeout-in-seconds"); 60 if(idleTimeout!=null) 61 { 62 idleTimeout = idleTimeout.trim(); 63 if (idleTimeout.length()==0) 64 { 65 addErrorDetails(result, compName); 66 result.failed(smh.getLocalString(getClass().getName()+".failed", 67 "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be empty. It should be between 0 and {0}", 68 new Object []{new Long (Long.MAX_VALUE)})); 69 }else 70 { 71 long value = new Integer (idleTimeout).longValue(); 72 if(value < 0 || value > Long.MAX_VALUE) 73 { 74 addErrorDetails(result, compName); 75 result.failed(smh.getLocalString(getClass().getName()+".failed1", 76 "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be {0}. It should be between 0 and {1}", 77 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 78 }else 79 { 80 addGoodDetails(result, compName); 81 result.passed(smh.getLocalString(getClass().getName()+".passed", 82 "PASSED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds is [{0}]", 83 new Object []{new Long (value)})); 84 } 85 } 86 }else { 88 addNaDetails(result, compName); 89 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 90 "NOT APPLICABLE [AS-EJB bean-cache] : cache-idle-timeout-in-seconds element not defined")); 91 } 92 }catch(NumberFormatException nfex) 93 { 94 Verifier.debug(nfex); 95 addErrorDetails(result, compName); 96 result.failed(smh.getLocalString(getClass().getName()+".failed2", 97 "FAILED [AS-EJB bean-cache] : [{0}] is not a valid Long number",new Object []{idleTimeout})); 98 99 } 100 }else { 102 addNaDetails(result, compName); 103 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 104 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 105 } 106 107 }catch(Exception ex){ 108 addErrorDetails(result, compName); 109 result.addErrorDetails(smh.getLocalString 110 (getClass().getName() + ".notRun", 111 "NOT RUN [AS-EJB] : Could not create an descriptor object")); 112 } 113 return result; 114 } 115 } 116 | Popular Tags |