1 package com.sun.enterprise.tools.verifier.tests.ejb.runtime.beancache; 2 3 4 26 27 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 28 import com.sun.enterprise.deployment.EjbDescriptor; 29 import com.sun.enterprise.deployment.EjbSessionDescriptor; 30 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 31 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 32 import com.sun.enterprise.tools.verifier.Result; 33 import com.sun.enterprise.deployment.EjbEntityDescriptor; 34 import com.sun.enterprise.deployment.EjbSessionDescriptor; 35 import com.sun.enterprise.deployment.runtime.BeanCacheDescriptor; 36 37 38 50 51 public class ASEjbBeanCache extends EjbTest implements EjbCheck { 52 53 public BeanCacheDescriptor beanCache; 54 public Result check(EjbDescriptor descriptor) 55 { 56 Result result = getInitializedResult(); 57 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 58 String beanCache = null; 59 try{ 60 beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache"); 61 if(beanCache!=null) 62 { 63 if(descriptor instanceof EjbEntityDescriptor 64 || (descriptor instanceof EjbSessionDescriptor 65 && ((EjbSessionDescriptor)descriptor).getSessionType().equals(EjbSessionDescriptor.STATEFUL))) 66 { 67 addGoodDetails(result, compName); 68 result.passed(smh.getLocalString(getClass().getName()+".passed", 69 "PASSED [AS-EJB ejb] : bean-cache Element parsed")); 70 } 71 else 72 { 73 addWarningDetails(result, compName); 74 result.warning(smh.getLocalString(getClass().getName()+".warning1", 75 "WARNING [AS-EJB ejb] : bean-cache should be defined only for Stateful Session and Entity Beans")); 76 } 77 } 78 else 79 { 80 addNaDetails(result, compName); 81 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 82 "NOT APPLICABLE [AS-EJB ejb] : bean-cache element not defined")); 83 } 84 }catch(Exception ex) 85 { 86 addErrorDetails(result, compName); 87 result.addErrorDetails(smh.getLocalString 88 (getClass().getName() + ".notRun", 89 "NOT RUN [AS-EJB] : Could not get a beanCache object")); 90 } 91 return result; 92 } 93 } 94 | Popular Tags |