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 ASEjbBCRemovalTimeout 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 removeTime = beanCache.getRemovalTimeoutInSeconds(); 67 if(removeTime!=null) 68 { 69 if(removeTime.length()==0) 70 { 71 result.failed(smh.getLocalString(getClass().getName()+".failed1", 72 "FAILED [AS-EJB bean-cache] : removal-timeout-in-seconds cannot be empty")); 73 } 74 else 75 { 76 try 77 { 78 long value = Long.valueOf(removeTime).longValue(); 79 if(value < 0 || value > Long.MAX_VALUE) 80 { 81 result.failed(smh.getLocalString(getClass().getName()+".failed2", 82 "FAILED [AS-EJB bean-cache] : removal-timeout-in-seconds cannot be {0}. It should be between 0 and {1}", 83 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 84 } 85 else 86 { 87 result.passed(smh.getLocalString(getClass().getName()+".passed", 88 "PASSED [AS-EJB bean-cache] : removal-timeout-in-seconds is {0}", 89 new Object []{new Long (value)})); 90 } 91 } 92 catch(NumberFormatException nfex) 93 { 94 Verifier.debug(nfex); 95 result.failed(smh.getLocalString(getClass().getName()+".failed3", 96 "FAILED [AS-EJB bean-cache] : The vale {0} for removal-timeout-in-seconds is not a valid Long number",new Object []{removeTime})); 97 } 98 } 99 } 100 else 101 { 102 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 103 "NOT APPLICABLE [AS-EJB bean-cache] : removal-timeout-in-seconds element not defined")); 104 } 105 } 106 else 107 { 108 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 109 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 110 } 111 } 112 else 113 { 114 result.addErrorDetails(smh.getLocalString 115 ("tests.componentNameConstructor", 116 "For [ {0} ]", 117 new Object [] {compName.toString()})); 118 result.addErrorDetails(smh.getLocalString 119 (getClass().getName() + ".notRun", 120 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 121 } 122 return result; 123 } 124 } 125 126 | Popular Tags |