1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.ias.beancache; 25 26 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 27 import java.util.*; 28 import com.sun.enterprise.deployment.EjbDescriptor; 29 import com.sun.enterprise.deployment.EjbSessionDescriptor; 30 import com.sun.enterprise.tools.verifier.*; 31 import com.sun.enterprise.tools.verifier.tests.*; 32 33 import com.sun.enterprise.tools.common.dd.ejb.*; 34 35 48 public class ASEjbBCCacheIdleTimeout extends ASEjbBeanCache 49 { 50 51 public Result check(EjbDescriptor descriptor) 52 { 53 54 Result result = getInitializedResult(); 55 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 56 57 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 58 String ejbName = null; 59 Ejb testCase = null; 60 boolean oneFailed = false; 61 if(ejbJar!=null) 62 { 63 getBeanCache(descriptor,ejbJar); 64 if(beanCache!=null) 65 { 66 String idleTimeout = beanCache.getCacheIdleTimeoutInSeconds(); 67 if(idleTimeout!=null) 68 { 69 if(idleTimeout.length()==0) 70 { 71 result.failed(smh.getLocalString(getClass().getName()+".failed", 72 "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be empty. It should be between 0 and {0}", 73 new Object []{new Long (Long.MAX_VALUE)})); 74 } 75 else 76 { 77 try 78 { 79 long value = Long.valueOf(idleTimeout).longValue(); 80 if(value < 0 || value > Long.MAX_VALUE) 81 { 82 result.failed(smh.getLocalString(getClass().getName()+".failed2", 83 "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be {0}. It should be between 0 and {1}", 84 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 85 } 86 else 87 { 88 result.passed(smh.getLocalString(getClass().getName()+".passed", 89 "PASSED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds is {0}", 90 new Object []{new Long (value)})); 91 } 92 } 93 catch(NumberFormatException nfex) 94 { 95 Verifier.debug(nfex); 96 result.failed(smh.getLocalString(getClass().getName()+".failed3", 97 "FAILED [AS-EJB bean-cache] : {0} is not a valid Long number",new Object []{idleTimeout})); 98 } 99 } 100 } 101 else 102 { 103 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 104 "NOT APPLICABLE [AS-EJB bean-cache] : cache-idle-timeout-in-seconds element not defined")); 105 } 106 } 107 else 108 { 109 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 110 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 111 } 112 } 113 else 114 { 115 result.addErrorDetails(smh.getLocalString 116 ("tests.componentNameConstructor", 117 "For [ {0} ]", 118 new Object [] {compName.toString()})); 119 result.addErrorDetails(smh.getLocalString 120 (getClass().getName() + ".notRun", 121 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 122 } 123 return result; 124 } 125 } 126 127 | Popular Tags |