1 package com.sun.enterprise.tools.verifier.tests.ejb.runtime.resource; 2 24 25 import java.util.*; 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 30 import com.sun.enterprise.deployment.ResourceReferenceDescriptor; 31 32 51 52 public class ASEjbRRefJndiName extends ASEjbResRef { 53 54 public Result check(EjbDescriptor descriptor) 55 { 56 Result result = getInitializedResult(); 57 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 58 boolean oneFailed = false; 59 61 try{ 62 Set resRef = descriptor.getResourceReferenceDescriptors(); 63 if(!(resRef.isEmpty())) 64 { 65 Iterator it = resRef.iterator(); 66 while (it.hasNext()) 67 { 68 ResourceReferenceDescriptor resDesc = ((ResourceReferenceDescriptor)it.next()); 69 String refName = resDesc.getName(); 70 String refJndiName = resDesc.getJndiName(); 71 String type = resDesc.getType(); 72 73 if(refJndiName == null || refJndiName.trim().equals("")) 74 { 75 oneFailed = true; 76 result.failed(smh.getLocalString(getClass().getName()+".failed", 77 "FAILED [AS-EJB resource-ref]: jndi-name is not a non empty string")); 78 } 79 156 } 157 } 158 else 159 { 160 addNaDetails(result, compName); 161 result.notApplicable(smh.getLocalString 162 (getClass().getName() + ".notApplicable", 163 "NOT APPLICABLE [AS-EJB] : {0} Does not define any resource-ref Elements", 164 new Object [] {descriptor.getName()})); 165 return result; 166 } 167 }catch(Exception ex) 168 { 169 oneFailed = true; 170 addErrorDetails(result, compName); 171 result.addErrorDetails(smh.getLocalString 172 (getClass().getName() + ".notRun", 173 "NOT RUN [AS-EJB] : Could not create the descriptor object")); 174 return result; 175 } 176 178 if(oneFailed) 179 result.setStatus(Result.FAILED); 180 else { 181 addGoodDetails(result, compName); 182 result.passed(smh.getLocalString(getClass().getName() + ".passed", 183 "PASSED [AS-EJB resource-ref]: jndi name is specified correctly for the resource-references with in the application", 184 new Object []{})); 185 } 186 return result; 187 } 188 } 189 | Popular Tags |