Enterprise Java Bean class constuctor test.
The class must have a public constructor that takes no parameters.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
Class c = loadEjbClass(descriptor, result);
if (c!=null) {
boolean foundOne = false;
Constructor [] constructors = c.getConstructors();
for (int i = 0; i < constructors.length; i++) {
int modifiers = constructors[i].getModifiers();
if (Modifier.isPublic(modifiers)) {
Class [] constructorParameterTypes;
constructorParameterTypes = constructors[i].getParameterTypes();
if (constructorParameterTypes.length > 0) {
continue;
} else {
foundOne = true;
break;
}
}
}
if (foundOne) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"Valid: This bean [ {0} ] has a public constructor method with no "
+ " \n parameters. Enterprise beans must have a public constructor "
+ " \n method with no parameters.",
new Object[] {descriptor.getEjbClassName()}));
} else {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: There is no public constructor method with no parameters"
+ "\n defined within bean [ {0} ]. Enterprise beans must have a "
+ "\n public constructor methods with no parameters.",
new Object[] {descriptor.getEjbClassName()}));
}
}
return result;