Home Interface test.
Verify that the bean home interface class exist and is loadable.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (!(descriptor instanceof EjbSessionDescriptor) &&
!(descriptor instanceof EjbEntityDescriptor)) {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable1",
"Test apply only to session or entity beans."));
return result;
}
if(getHomeInterfaceName(descriptor) == null || "".equals(getHomeInterfaceName(descriptor))){
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor", "For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
"Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
new Object[] {descriptor.getEjbClassName()}));
return result;
}
// verify that the home interface class exist and is loadable
try {
Context context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class c = Class.forName(getClassName(descriptor), false, jcl);
if (c != null) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"Home interface [ {0} ] exist and is loadable.",
new Object[] {getClassName(descriptor)}));
} else {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: Home interface [ {0} ] does not exist or is not loadable.",
new Object[] {getClassName(descriptor)}));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: Home interface [ {0} ] does not exist or is not loadable.",
new Object[] {getClassName(descriptor)}));
}
return result;