FileDocCategorySizeDatePackage
EjbResAuthElement.javaAPI DocGlassfish v2 API4944Fri May 04 22:33:36 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.elements

EjbResAuthElement

public class EjbResAuthElement extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
The resource-ref element res-auth subelement must be "Application" or "Container".

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(EjbDescriptor descriptor)
The resource-ref element res-auth subelement must be "Application" or "Container".

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	boolean oneFailed = false;
	if (!descriptor.getResourceReferenceDescriptors().isEmpty()) {
	    for (Iterator itr = descriptor.getResourceReferenceDescriptors().iterator(); itr.hasNext();) {
		ResourceReferenceDescriptor nextResourceReference = (ResourceReferenceDescriptor) itr.next();
		// The resource-ref element res-auth subelement must be "Application" or
		// "Container".
		if ((nextResourceReference.getAuthorization().equals(ResourceReferenceDescriptor.APPLICATION_AUTHORIZATION)) ||
		    (nextResourceReference.getAuthorization().equals(ResourceReferenceDescriptor.CONTAINER_AUTHORIZATION))) {
		    result.addGoodDetails(smh.getLocalString
					  ("tests.componentNameConstructor",
					   "For [ {0} ]",
					   new Object[] {compName.toString()}));
		    result.addGoodDetails
			(smh.getLocalString
			 (getClass().getName() + ".passed",
			  "Resource-ref element res-auth sub-element value [ {0} ] is valid within bean [ {1} ]",
			  new Object[] {nextResourceReference.getAuthorization(),descriptor.getName()}));
		} else {
		    oneFailed = true;
		    result.addErrorDetails(smh.getLocalString
					   ("tests.componentNameConstructor",
					    "For [ {0} ]",
					    new Object[] {compName.toString()}));
		    result.addErrorDetails
			(smh.getLocalString
			 (getClass().getName() + ".failed",
			  "Error: Resource-ref element res-auth sub-element value [ {0} ] is not valid within bean [ {1} ]",
			  new Object[] {nextResourceReference.getAuthorization(),descriptor.getName()}));
		} 
	    }
	    if (!oneFailed){
		result.setStatus(Result.PASSED);
	    } else {
		result.setStatus(Result.FAILED);
	    }
	} else {
	    result.addNaDetails(smh.getLocalString
				("tests.componentNameConstructor",
				 "For [ {0} ]",
				 new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
				 (getClass().getName() + ".notApplicable",
				  "There are no resource reference elements defined within this bean [ {0} ]",
				  new Object[] {descriptor.getName()}));
	}


	return result;