1 package com.sun.enterprise.tools.verifier.tests.ejb.ias.beancache; 2 3 4 26 27 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 28 import java.util.*; 29 import com.sun.enterprise.deployment.EjbDescriptor; 30 import com.sun.enterprise.deployment.EjbSessionDescriptor; 31 import com.sun.enterprise.tools.verifier.*; 32 import com.sun.enterprise.tools.verifier.tests.*; 33 34 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 35 36 import com.sun.enterprise.tools.common.dd.ejb.SunEjbJar; 37 import com.sun.enterprise.tools.common.dd.ejb.EnterpriseBeans; 38 import com.sun.enterprise.tools.common.dd.ejb.Ejb; 39 import com.sun.enterprise.deployment.EjbEntityDescriptor; 40 import com.sun.enterprise.deployment.EjbSessionDescriptor; 41 import java.lang.reflect.*; 42 43 import com.sun.enterprise.tools.common.dd.ejb.BeanCache; 44 45 57 public class ASEjbBeanCache extends EjbTest implements EjbCheck { 58 59 public BeanCache beanCache; 60 public Ejb testCase; 61 62 public void getBeanCache(EjbDescriptor descriptor, SunEjbJar ejbJar) 63 { 64 testCase = getEjb(descriptor.getName(),ejbJar); 65 beanCache = testCase.getBeanCache(); 66 } 67 68 public Result check(EjbDescriptor descriptor) 69 { 70 Result result = getInitializedResult(); 71 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 72 73 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 74 if(ejbJar!=null) 75 { 76 getBeanCache(descriptor,ejbJar); 77 if(beanCache!=null) 78 { 79 if(descriptor instanceof EjbEntityDescriptor 80 || (descriptor instanceof EjbSessionDescriptor 81 && ((EjbSessionDescriptor)descriptor).getSessionTypeString().equals(EjbSessionDescriptor.STATEFUL))) 82 { 83 result.passed(smh.getLocalString(getClass().getName()+".passed", 84 "PASSED [AS-EJB ejb] : bean-cache Element parsed")); 85 } 86 else 87 { 88 result.warning(smh.getLocalString(getClass().getName()+".warning1", 89 "WARNING [AS-EJB ejb] : bean-cache should be defined only for Stateful Session and Entity Beans")); 90 } 91 102 } 103 else 104 { 105 if(descriptor instanceof EjbEntityDescriptor 106 || (descriptor instanceof EjbSessionDescriptor 107 && ((EjbSessionDescriptor)descriptor).getSessionTypeString().equals(EjbSessionDescriptor.STATEFUL))) 108 { 109 result.warning(smh.getLocalString(getClass().getName()+".warning", 110 "WARNING [AS-EJB ejb] : bean-cache should be defined for Stateful Session and Entity Beans")); 111 } 112 else 113 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 114 "NOT APPLICABLE [AS-EJB ejb] : bean-cache element not defined")); 115 } 116 } 117 else 118 { 119 result.addErrorDetails(smh.getLocalString 120 ("tests.componentNameConstructor", 121 "For [ {0} ]", 122 new Object [] {compName.toString()})); 123 result.addErrorDetails(smh.getLocalString 124 (getClass().getName() + ".notRun", 125 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 126 } 127 return result; 128 } 129 } 130 131 | Popular Tags |