1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.ias.beanpool; 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 36 52 public class ASEjbBPPoolResizeQty extends ASEjbBeanPool 53 { 54 55 public Result check(EjbDescriptor descriptor) 56 { 57 58 Result result = getInitializedResult(); 59 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 60 61 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 62 String ejbName = null; 63 Ejb testCase = null; 64 boolean oneFailed = false; 65 if(ejbJar!=null) 66 { 67 getBeanPool(descriptor,ejbJar); 68 if(beanPool!=null) 69 { 70 String poolResizeQty = beanPool.getResizeQuantity(); 71 if(poolResizeQty!=null) 72 { 73 if(poolResizeQty.length()==0) 74 { 75 result.failed(smh.getLocalString(getClass().getName()+".failed1", 76 "FAILED [AS-EJB bean-pool] : resize-quantity cannot be empty")); 77 } 78 else 79 { 80 try 81 { 82 int value = Integer.valueOf(poolResizeQty).intValue(); 83 if(value < 0 || value > Integer.MAX_VALUE) 84 { 85 result.failed(smh.getLocalString(getClass().getName()+".failed2", 86 "FAILED [AS-EJB bean-pool] : resize-quantity cannot be {0}. It should be between 0 and {1}", 87 new Object []{new Integer (value),new Integer (Integer.MAX_VALUE)})); 88 } 89 else 90 { 91 String maxPoolSize = beanPool.getMaxPoolSize(); 92 int maxPool =0; 93 if(maxPoolSize == null) 94 { 95 result.passed(smh.getLocalString(getClass().getName()+".passed1", 96 "PASSED [AS-EJB bean-pool] : resize-quantity is {0}", new Object []{new Integer (value)})); 97 } 98 else 99 { 100 try{ 101 maxPool = Integer.parseInt(maxPoolSize); 102 }catch(NumberFormatException nfe){ 103 result.failed(smh.getLocalString(getClass().getName()+".failed3", 104 "FAILED [AS-EJB bean-pool] : The value {0} for max-pool-size is not a valid Integer number",new Object []{maxPoolSize})); 105 106 return result; 107 108 } 109 if(value <= maxPool) 111 { 112 result.passed(smh.getLocalString(getClass().getName()+".passed2", 113 "PASSED [AS-EJB bean-pool] : resize-quantity is {0} and is less-than/equal to max-pool-size[{1}]", 114 new Object []{new Integer (value), new Integer (maxPool)})); 115 } 117 else 118 { 119 result.warning(smh.getLocalString(getClass().getName()+".warning", 120 "WARNING [AS-EJB bean-pool] : resize-quantity [{0}] is greater than max-pool-size [{1}]",new Object []{new Integer (value), new Integer (maxPool)})); 121 } 122 } 123 } 124 } 125 catch(NumberFormatException nfex) 126 { 127 Verifier.debug(nfex); 128 result.failed(smh.getLocalString(getClass().getName()+".failed4", 129 "FAILED [AS-EJB bean-pool] : The value {0} for resize-quantity is not a valid Integer number", 130 new Object []{poolResizeQty})); 131 } 132 } 133 } 134 else 135 { 136 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 137 "NOT APPLICABLE [AS-EJB bean-pool] : resize-quantity element not defined")); 138 } 139 } 140 else 141 { 142 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable2", 143 "NOT APPLICABLE [AS-EJB] : bean-pool element not defined")); 144 } 145 } 146 else 147 { 148 result.addErrorDetails(smh.getLocalString 149 ("tests.componentNameConstructor", 150 "For [ {0} ]", 151 new Object [] {compName.toString()})); 152 result.addErrorDetails(smh.getLocalString 153 (getClass().getName() + ".notRun", 154 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 155 } 156 return result; 157 } 158 } 159 160 161 | Popular Tags |