Session Bean State management test (stateful/stateless).
If the enterprise bean is a Session Bean, the Bean provider must use
the "session-type" element to declare whether the session bean
is stateful or stateless.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbSessionDescriptor) {
String stateType = ((EjbSessionDescriptor)descriptor).getSessionType();
if ((EjbSessionDescriptor.STATELESS.equals(stateType)) ||
(EjbSessionDescriptor.STATEFUL.equals(stateType))) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"[ {0} ] is valid stateType within bean [ {1} ].",
new Object[] {stateType,descriptor.getName()}));
} 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 stateType within bean [ {1} ].",
new Object[] {stateType, 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 {1} bean, but called with {2} bean.",
new Object[] {getClass(),"Session","Entity"}));
return result;
}