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 47 public class ASEjbBCMaxCacheSize extends ASEjbBeanCache 48 { 49 50 public Result check(EjbDescriptor descriptor) 51 { 52 53 Result result = getInitializedResult(); 54 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 55 56 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 57 String ejbName = null; 58 Ejb testCase = null; 59 boolean oneFailed = false; 60 if(ejbJar!=null) 61 { 62 getBeanCache(descriptor,ejbJar); 63 if(beanCache!=null) 64 { 65 try 66 { 67 String maxCacheSizeStr = beanCache.getMaxCacheSize(); 68 if(maxCacheSizeStr!=null) 69 { 70 if(maxCacheSizeStr.length()==0) 71 { 72 result.failed(smh.getLocalString(getClass().getName()+".failed1", 73 "FAILED [AS-EJB bean-cache] : max-cache-size cannot be empty. It should be between 1 and MAX_INT")); 74 } 75 else 76 { 77 int maxCacheSize = Integer.valueOf(beanCache.getMaxCacheSize()).intValue(); 78 if(maxCacheSize < 1 || maxCacheSize > Integer.MAX_VALUE) 79 { 80 result.failed(smh.getLocalString(getClass().getName()+".failed2", 81 "FAILED [AS-EJB bean-cache] : max-cache-size cannot be less than 1 or greater than MAX_INT")); 82 } 83 else 84 result.passed(smh.getLocalString(getClass().getName()+".passed1", 85 "PASSED [AS-EJB bean-cache] : max-cache-size is {0}",new Object []{(new Integer (maxCacheSize))})); 86 } 87 } 88 else 89 { 90 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 91 "NOT APPLICABLE [AS-EJB bean-cache] : max-cache-size is element not defined")); 92 } 93 } 94 catch(NumberFormatException nfex) 95 { 96 Verifier.debug(nfex); 97 result.failed(smh.getLocalString(getClass().getName()+".failed3", 98 "FAILED [AS-EJB bean-cache] : max-cache-size is invalid. It should be a valid integer")); 99 } 100 } 101 else 102 { 103 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 104 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 105 } 106 } 107 else 108 { 109 result.addErrorDetails(smh.getLocalString 110 ("tests.componentNameConstructor", 111 "For [ {0} ]", 112 new Object [] {compName.toString()})); 113 result.addErrorDetails(smh.getLocalString 114 (getClass().getName() + ".notRun", 115 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 116 } 117 return result; 118 } 119 } 120 121 | Popular Tags |