Entity Bean's Persistence management test.
If the enterprise bean is a Entity Bean, the Bean provider must use
the "persistence-type" element to declare whether the persistence
management is performed by the enterprise bean or the container.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
String persistence =
((EjbEntityDescriptor)descriptor).getPersistenceType();
if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistence) ||
EjbEntityDescriptor.CONTAINER_PERSISTENCE.equals(persistence)) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"[ {0} ] is valid persistence type.",
new Object[] {persistence}));
} else {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: [ {0} ] is not valid persistence type within bean [ {1} ].",
new Object[] {persistence, descriptor.getName()}));
}
return result;
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"[ {0} ] expected \n {1} bean, but called with {2} bean.",
new Object[] {getClass(),"Entity","Session"}));
return result;
}