The resource-ref element res-auth subelement must be "Application" or
"Container".
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;