Local Interface test.
Verify that the bean remote or local interface class exist and is loadable.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (!(descriptor instanceof EjbSessionDescriptor) &&
!(descriptor instanceof EjbEntityDescriptor)) {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfaceClassExist.notApplicable1",
"Test apply only to session or entity beans."));
return result;
}
if(getInterfaceName(descriptor) == null || "".equals(getInterfaceName(descriptor))){
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfaceClassExist.notApplicable2",
"Not Applicable because, EJB [ {0} ] does not have {1} Interface.",
new Object[] {descriptor.getEjbClassName(), getInterfaceType()}));
return result;
}
// verify that the local or remote interface class exist and is loadable
try {
ClassLoader jcl = getVerifierContext().getClassLoader();
Class c = Class.forName(getClassName(descriptor), false, jcl);
if(!c.isInterface()) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfaceClassExist.failed",
"[ {0} ] is defined as a class. It should be an interface.",
new Object[] {getClassName(descriptor)}));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
addErrorDetails(result, compName);
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: "+ getInterfaceType() +" interface [ {0} ] does not exist or is not loadable.",
new Object[] {getClassName(descriptor)}));
}
if(result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
getInterfaceType() + " interface [ {0} ] exist and is loadable.",
new Object[] {getClassName(descriptor)}));
}
return result;