The interfaces/classes that the entity bean implements must be
serializable directly or indirectly.
Ejb 2.1 says that "The bean class that uses the timer service must
implement the javax.ejb.TimedObject interface."
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
try {
Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
boolean validBean = true;
Class superClass = c.getSuperclass();
if (validBean == true) {
// walk up the class tree
if(!(superClass.getName()).equals("java.lang.Object")) {
if (!isValidSerializableType(superClass) &&
!isTimedObject(superClass)) {
validBean = false;
result.addWarningDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addWarningDetails(smh.getLocalString
(getClass().getName() + ".failed1",
"[ {0} ] extends class [ {1} ] which is not serializable. ",
new Object[] {descriptor.getEjbClassName(),superClass.getName()}));
result.setStatus(Result.WARNING);
return result;
} else {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed1",
"Bean [ {0} ] extends class [ {1} ] which is serializable. ",
new Object[] {descriptor.getEjbClassName(), superClass.getName()}));
do {
Class[] interfaces = c.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
logger.log(Level.FINE, getClass().getName() + ".debug1",
new Object[] {interfaces[i].getName()});
if (!isValidSerializableType(interfaces[i])
&& !isTimedObject(interfaces[i])) {
validBean = false;
result.addWarningDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addWarningDetails(smh.getLocalString
(getClass().getName() + ".failed",
"[ {0} ] implements interface [ {1} ] which is not serializable. ",
new Object[] {descriptor.getEjbClassName(),interfaces[i].getName()}));
result.setStatus(Result.WARNING);
break;
}
}
} while ((((c=c.getSuperclass()) != null) && (validBean != false)));
}
}
if (validBean == true){
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"Bean [ {0} ] implements interfaces which are all serializable. ",
new Object[] {descriptor.getEjbClassName()}));
result.setStatus(Result.PASSED);
}
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failedException",
"Error: [ {0} ] class not found.",
new Object[] {descriptor.getEjbClassName()}));
}
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(),"Entity","Session"}));
return result;
}