This method is responsible for the logic of the test. It is called for both local and remote interfaces.
boolean oneFailed = false;
try {
Class c = Class.forName(remote, false, getVerifierContext().getClassLoader());
boolean foundAtLeastOne = false;
try {
// Check first that pk fields set methods are mot part of the remote interface
PersistentFieldInfo[] pkFieldInfos = ((EjbCMPEntityDescriptor)descriptor).getPersistenceDescriptor().getPkeyFieldInfo();
for (int i=0;i<pkFieldInfos.length;i++) {
foundAtLeastOne = true;
PersistentFieldInfo info = pkFieldInfos[i];
// check that setXXX is not part of the remote interface
String setMethodName = "set" + Character.toUpperCase(info.name.charAt(0)) + info.name.substring(1);
Class parms[] = { info.type };
Method setMethod = getMethod(c, setMethodName, parms );
if (setMethod != null) {
// oopss
result.addWarningDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addWarningDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmpFieldsAccessorExposition.failed",
"Error : Primary key field set accessor method [ {0} ] is exposed through the component interface [ {1} ]",
new Object[] {info.name,remote}));
oneFailed = true;
} else {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmpFieldsAccessorExposition.passed",
"Primary key field set accessor method [ {0} ] is not exposed through the component interface [ {1} ]",
new Object[] {info.name,remote}));
}
}
if (foundAtLeastOne == false) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmpFieldsAccessorExposition.notApplicable",
"No persistent fields found.",
new Object[] {}));
return oneFailed;
}
} catch (RuntimeException rt) {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmpFieldsAccessorExposition.failedException1",
"Exception occured while trying to access Primary key info in PersistenceDescriptor.",
new Object[] {}));
}
return oneFailed;
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.EjbTest.failedException",
"Error: [ {0} ] class not found.",
new Object[] {descriptor.getEjbClassName()}));
oneFailed = true;
return oneFailed;
}