1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.runtime.beancache; 25 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.Result; 28 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 29 30 31 44 45 public class ASEjbBCVictimPolicy extends ASEjbBeanCache 46 { 47 48 public Result check(EjbDescriptor descriptor) 49 { 50 Result result = getInitializedResult(); 51 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 52 String beanCache = null; 53 String victimPolicy = null; 54 try{ 55 beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache"); 56 if(beanCache!=null) 57 { 58 victimPolicy = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/victim-selection-policy"); 59 if(victimPolicy!=null) 60 { 61 victimPolicy = victimPolicy.trim(); 62 if(victimPolicy.length()==0) 63 { 64 addErrorDetails(result, compName); 65 result.failed(smh.getLocalString(getClass().getName()+".failed", 66 "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be empty. It has to be either FIFO, NRU or LRU")); 67 }else 68 { 69 if(!victimPolicy.equalsIgnoreCase("FIFO") && !victimPolicy.equalsIgnoreCase("NRU") 70 && !victimPolicy.equalsIgnoreCase("LRU")) 71 { 72 addErrorDetails(result, compName); 73 result.failed(smh.getLocalString(getClass().getName()+".failed1", 74 "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be [{0}]. It should be either FIFO, NRU or LRU [case insensitive]", 75 new Object []{victimPolicy})); 76 } 77 else 78 { 79 addGoodDetails(result, compName); 80 result.passed(smh.getLocalString(getClass().getName()+".passed", 81 "PASSED [AS-EJB bean-cache] : victim-selection-policy is {0}", 82 new Object []{victimPolicy})); 83 } 84 } 85 }else { 87 addNaDetails(result, compName); 88 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 89 "NOT APPLICABLE [AS-EJB bean-cache] : victim-selection-policy element not defined")); 90 91 } 92 93 }else { 95 addNaDetails(result, compName); 96 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 97 "NOT APPLICABLE [AS-EJB] : bean-cache element not defined")); 98 99 } 100 }catch(Exception ex){ 101 addErrorDetails(result, compName); 102 result.addErrorDetails(smh.getLocalString 103 (getClass().getName() + ".notRun", 104 "NOT RUN [AS-EJB] : Could not create the descriptor object")); 105 } 106 return result; 107 } 108 } 109 | Popular Tags |