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 48 public class ASEjbBCVictimPolicy extends ASEjbBeanCache 49 { 50 51 public Result check(EjbDescriptor descriptor) 52 { 53 54 Result result = getInitializedResult(); 55 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 56 57 SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject(); 58 String ejbName = null; 59 Ejb testCase = null; 60 boolean oneFailed = false; 61 if(ejbJar!=null) 62 { 63 getBeanCache(descriptor,ejbJar); 64 if(beanCache!=null) 65 { 66 String victimPolicy = beanCache.getVictimSelectionPolicy(); 67 if(victimPolicy!=null) 68 { 69 if(victimPolicy.length()==0) 70 { 71 result.failed(smh.getLocalString(getClass().getName()+".failed1", 72 "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be empty. It has to be either FIFO, NRU or LRU")); 73 } 74 else 75 { 76 if(!victimPolicy.equalsIgnoreCase("FIFO") && !victimPolicy.equalsIgnoreCase("NRU") 77 && !victimPolicy.equalsIgnoreCase("LRU")) 78 { 79 result.failed(smh.getLocalString(getClass().getName()+".failed2", 80 "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be {0}. It should be either FIFO, NRU or LRU [case insensitive]", 81 new Object []{victimPolicy})); 82 } 83 else 84 { 85 result.passed(smh.getLocalString(getClass().getName()+".passed", 86 "PASSED [AS-EJB bean-cache] : victim-selection-policy is {0}", 87 new Object []{victimPolicy})); 88 } 89 } 90 } 91 else 92 { 93 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 94 "NOT APPLICABLE [AS-EJB bean-cache] : victim-selection-policy element not defined")); 95 } 96 } 97 else 98 { 99 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 100 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 101 } 102 } 103 else 104 { 105 result.addErrorDetails(smh.getLocalString 106 ("tests.componentNameConstructor", 107 "For [ {0} ]", 108 new Object [] {compName.toString()})); 109 result.addErrorDetails(smh.getLocalString 110 (getClass().getName() + ".notRun", 111 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 112 } 113 return result; 114 } 115 } 116 117 | Popular Tags |