run an individual verifier test of a declated cmr field of the class
// check first if this is one-to-one or many-to-one relationship ...previous version of ejb specs
// if ((!rrd.getIsMany() && !rrd.getPartner().getIsMany()) ||
// (rrd.getIsMany() && !rrd.getPartner().getIsMany())) {
// }
// everyone falls back and should be checked
boolean pass = true;
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
// should not have accessor methods exposed.
if (((EjbDescriptor)descriptor).getRemoteClassName() != null &&
!((((EjbDescriptor)descriptor).getRemoteClassName()).equals(""))) {
String interfaceType = ((EjbDescriptor)descriptor).getRemoteClassName();
try {
CMRFieldInfo info = rrd.getCMRFieldInfo();
Class remoteInterface = Class.forName(interfaceType, false, getVerifierContext().getClassLoader());
String getMethodName = "get" + Character.toUpperCase(info.name.charAt(0)) + info.name.substring(1);
String setMethodName = "set" + Character.toUpperCase(info.name.charAt(0)) + info.name.substring(1);
Method getMethod = getMethod(remoteInterface, getMethodName, null);
if (getMethod != null) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmrFieldsAccessorExposition.failed",
"Error : CMR field {0} accessor method [ {1} ] is exposed through the component interface [ {2} ]",
new Object[] {"get", info.name, interfaceType}));
pass = false;
} 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.CmrFieldsAccessorExposition.passed",
"CMR field {0} accessor method [ {1} ] is not exposed through the component interface [ {2} ]",
new Object[] {"get", info.name, interfaceType}));
pass = true;
}
Class parms[] = { info.type };
Method setMethod = getMethod(remoteInterface, setMethodName, parms );
if (setMethod != null) {
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmrFieldsAccessorExposition.failed",
"Error : CMR field {0} accessor method [ {1} ] is exposed through the component interface [ {2} ]",
new Object[] {"set", info.name, interfaceType}));
pass = false;
} 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.CmrFieldsAccessorExposition.passed",
"CMR field [{0}] accessor method [ {1} ] is not exposed through the component interface [ {2} ]",
new Object[] {"set", info.name, interfaceType}));
}
} catch (Exception e) {
Verifier.debug(e);
addErrorDetails(result, compName);
result.addErrorDetails(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmrFieldsAccessorExposition.failedException",
"Error: [{0}] class not found or local interface not defined",
new Object[] {interfaceType}));
pass = false;
}
}
return pass;