1 package com.sun.enterprise.tools.verifier.tests.ejb.runtime; 2 3 25 26 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 27 import com.sun.enterprise.deployment.EjbDescriptor; 28 import com.sun.enterprise.tools.verifier.*; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 31 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 32 33 import com.sun.enterprise.deployment.RunAsIdentityDescriptor; 34 35 42 public class ASEjbPrincipal extends EjbTest implements EjbCheck { 43 44 45 public Result check(EjbDescriptor descriptor) 46 { 47 Result result = getInitializedResult(); 48 49 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 50 51 boolean oneFailed = false; 52 try{ 53 if (descriptor.getUsesCallerIdentity() == false){ 54 RunAsIdentityDescriptor runAsIdDesc = descriptor.getRunAsIdentity(); 55 if (runAsIdDesc != null){ 56 String principal = runAsIdDesc.getPrincipal(); 57 if (principal == null){ 58 addNaDetails(result, compName); 59 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 60 "NOT APPLICABLE [AS-EJB ejb] : principal element not defined")); 61 }else{ 62 if(principal.length()==0){ 63 addErrorDetails(result, compName); 64 result.failed(smh.getLocalString(getClass().getName()+".failed", 65 "FAILED [AS-EJB principal] : name cannot be an empty String")); 66 }else{ 67 addGoodDetails(result, compName); 68 result.passed(smh.getLocalString(getClass().getName()+".passed", 69 "PASSED [AS-EJB principal] : name is {0}", new Object []{principal})); 70 } 71 } 72 } 73 }else{ 74 addNaDetails(result, compName); 75 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable", 76 "NOT APPLICABLE [AS-EJB ejb] run-as Element is not defined")); 77 } 78 }catch(Exception ex){ 79 addErrorDetails(result, compName); 80 result.addErrorDetails(smh.getLocalString 81 (getClass().getName() + ".notRun", 82 "NOT RUN [AS-EJB] : Could not create an SunEjbJar object")); 83 } 84 85 return result; 86 } 87 } 88 | Popular Tags |