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