Define primary key class test.
Enterprise Bean's primary key class
The Bean provider must specify a primary key class in the deployment
descriptor.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
boolean oneFailed = false;
// retrieve the EJB primary key class
String primaryKeyType = ((EjbEntityDescriptor)descriptor).getPrimaryKeyClassName();
if (!primaryKeyType.equals("")) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".debug1",
"For EJB primary key class [ {0} ]",
new Object[] {primaryKeyType}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"A primary key class was defined in the deployment descriptor."));
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".debug1",
"For EJB primary key class [ {0} ]",
new Object[] {primaryKeyType}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: A primary key class was not defined in the deployment descriptor."));
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else {
result.setStatus(result.PASSED);
}
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;
}