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 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 36 37 53 public class ASEjbBPMaxWaitTime extends ASEjbBeanPool 54 { 55 56 public Result check(EjbDescriptor descriptor) 57 { 58 59 Result result = getInitializedResult(); 60 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 61 62 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 63 String ejbName = null; 64 Ejb testCase = null; 65 boolean oneFailed = false; 66 if(ejbJar!=null) 67 { 68 getBeanPool(descriptor,ejbJar); 69 if(beanPool!=null) 70 { 71 String maxWaitTime = beanPool.getMaxWaitTimeInMillis(); 72 if(maxWaitTime!=null) 73 { 74 if(maxWaitTime.length()==0) 75 { 76 result.failed(smh.getLocalString(getClass().getName()+".failed1", 77 "FAILED [AS-EJB bean-pool] : max-wait-time-in-millis cannot be empty")); 78 } 79 else 80 { 81 if(descriptor instanceof EjbMessageBeanDescriptor) 82 { 83 result.warning(smh.getLocalString(getClass().getName()+".warning", 84 "WARNING [AS-EJB bean-pool] : max-wait-time-in-millis is not applicable for Message Driven Beans")); 85 } 86 try 87 { 88 long value = Long.valueOf(maxWaitTime).longValue(); 89 if(value < 0 || value > Long.MAX_VALUE) 90 { 91 result.failed(smh.getLocalString(getClass().getName()+".failed2", 92 "FAILED [AS-EJB bean-pool] : max-wait-time-in-millis cannot be {0}. It should be between 0 and {1}", 93 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 94 } 95 else 96 { 97 result.passed(smh.getLocalString(getClass().getName()+".passed", 98 "PASSED [AS-EJB bean-pool] : max-wait-time-in-millis is {0}", 99 new Object []{new Long (value)})); 100 } 101 } 102 catch(NumberFormatException nfex) 103 { 104 Verifier.debug(nfex); 105 result.failed(smh.getLocalString(getClass().getName()+".failed3", 106 "FAILED [AS-EJB bean-pool] : The value {0} for max-wait-time-in-millis is not a valid Long number", 107 new Object []{maxWaitTime})); 108 } 109 } 110 } 111 else 112 { 113 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 114 "NOT APPLICABLE [AS-EJB bean-pool] : max-wait-time-in-millis element not defined")); 115 } 116 } 117 else 118 { 119 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 120 "NOT APPLICABLE [AS-EJB] : bean-pool element not defined")); 121 } 122 } 123 else 124 { 125 result.addErrorDetails(smh.getLocalString 126 ("tests.componentNameConstructor", 127 "For [ {0} ]", 128 new Object [] {compName.toString()})); 129 result.addErrorDetails(smh.getLocalString 130 (getClass().getName() + ".notRun", 131 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 132 } 133 return result; 134 } 135 } 136 | Popular Tags |