Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if(getHomeInterfaceName(descriptor) == null || "".equals(getHomeInterfaceName(descriptor))){
addNaDetails(result, compName);
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;
}
if (!(descriptor instanceof EjbSessionDescriptor) &&
!(descriptor instanceof EjbEntityDescriptor)) {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable1",
"Test apply only to session or entity beans."));
return result;
}
boolean homeMethodFound = false;
try {
// retrieve the remote interface methods
ClassLoader jcl = getVerifierContext().getClassLoader();
Class homeInterfaceClass = Class.forName(getClassName(descriptor), false, jcl);
Vector<Method> v = new Vector<Method>();
while (homeInterfaceClass != null &&
!homeInterfaceClass.getName().equals(getSuperInterface()) &&
!homeInterfaceClass.getName().equals("java.lang.Object")) {
Method [] homeInterfaceMethods = homeInterfaceClass.getDeclaredMethods();
for (int i=0;i<homeInterfaceMethods.length;i++) {
v.add(homeInterfaceMethods[i]);
}
homeInterfaceClass = homeInterfaceClass.getSuperclass();
}
Iterator iterator = v.iterator();
while (iterator.hasNext()) {
Method method = (Method) iterator.next();
String methodName = method.getName();
if (methodName.startsWith("create") || methodName.startsWith("find") ||
methodName.startsWith("remove"))
continue;
Method m = getMethod(javax.ejb.EJBHome.class, methodName,
method.getParameterTypes());
if (m!=null) {
// this is an EJBHome method...
continue;
}
homeMethodFound = true;
// if (!runIndividualHomeMethodTest( method,descriptor, result))
// oneFailed = true;
runIndividualHomeMethodTest( method,descriptor, result);
if (result.getStatus() == Result.FAILED)
break;
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
addErrorDetails(result, compName);
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.failedException",
"Error: Home interface [ {0} ] does not exist or is not loadable within bean [ {1} ]",
new Object[] {getClassName(descriptor),descriptor.getName()}));
}
if (!homeMethodFound) {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable2",
"Home interface [ {0} ] does not define any home methods",
new Object[] {getClassName(descriptor)}));
} //else {
// result.setStatus(oneFailed?result.FAILED:Result.PASSED);
// }
return result;