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 ASEjbBCResizeQuantity 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 resizeQtyStr = beanCache.getResizeQuantity(); 68 if(resizeQtyStr!=null) 69 { 70 if(resizeQtyStr.length()==0) 71 { 72 result.failed(smh.getLocalString(getClass().getName()+".failed1", 73 "FAILED [AS-EJB bean-cache] : resize-quantity cannot be empty. It should be between 1 and {0}",new Object []{new Integer (Integer.MAX_VALUE)})); 74 } 75 else 76 { 77 int resizeQty = Integer.valueOf(resizeQtyStr).intValue(); 78 if(resizeQty < 1 || resizeQty > Integer.MAX_VALUE) 79 { 80 result.failed(smh.getLocalString(getClass().getName()+".failed2", 81 "FAILED [AS-EJB bean-cache] : resize-quantity cannot be less than 1 or greater than {0}", new Object []{new Integer (Integer.MAX_VALUE)})); 82 } 83 else 84 { 85 86 try{ 87 String maxCacheSizeStr = beanCache.getMaxCacheSize(); 88 if(maxCacheSizeStr != null && maxCacheSizeStr.length() >0) 89 { 90 int maxCacheSize = Integer.valueOf(beanCache.getMaxCacheSize()).intValue(); 91 if(maxCacheSize >= 1 && maxCacheSize <= Integer.MAX_VALUE) 92 { 93 if(resizeQty <= maxCacheSize) 94 { 95 result.passed(smh.getLocalString(getClass().getName()+".passed1","PASSED [AS-EJB bean-cache] : resize-quantity is {0} and is less than max-cache-size {1}",new Object []{(new Integer (resizeQty)),new Integer (maxCacheSize)})); 96 } 97 else 98 { 99 result.failed(smh.getLocalString(getClass().getName()+".failed3","FAILED [AS-EJB bean-cache] : resize-quantity {0} should be less than max-cache-size {1}",new Object []{new Integer (resizeQty), new Integer (maxCacheSize)})); 100 } 101 }else 102 { 103 result.failed(smh.getLocalString(getClass().getName()+".failed4","FAILED [AS-EJB bean-cache] : resize-quantity should be less than max-cache-size and max-cache-size is not a valid integer")); 104 } 105 } 106 else 107 { 108 result.passed(smh.getLocalString(getClass().getName()+".passed2","PASSED [AS-EJB bean-cache] : resize-quantity is {0}",new Object []{(new Integer (resizeQty))})); 109 } 110 111 }catch(NumberFormatException nfex){ 112 result.failed(smh.getLocalString(getClass().getName()+".failed3","FAILED [AS-EJB bean-cache] : resize-quantity should be less than max-cache-size and max-cache-size is not a valid integer")); 113 } 114 } 115 } 116 } 117 else 118 { 119 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 120 "NOT APPLICABLE [AS-EJB bean-cache] : resize-quantity element is not defined")); 121 } 122 } 123 catch(NumberFormatException nfex) 124 { 125 Verifier.debug(nfex); 126 result.failed(smh.getLocalString(getClass().getName()+".failed5", 127 "FAILED [AS-EJB bean-cache] : resize-quantity is invalid. It should be a valid integer")); 128 } 129 } 130 else 131 { 132 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable2", 133 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 134 } 135 } 136 else 137 { 138 result.addErrorDetails(smh.getLocalString 139 ("tests.componentNameConstructor", 140 "For [ {0} ]", 141 new Object [] {compName.toString()})); 142 result.addErrorDetails(smh.getLocalString 143 (getClass().getName() + ".notRun", 144 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 145 } 146 return result; 147 } 148 } 149 150 | Popular Tags |