Test for each adminobject, that "adminobject-class"
implements "adminobject-interface".
Result result = getInitializedResult();
ComponentNameConstructor compName =
getVerifierContext().getComponentNameConstructor();
if(!descriptor.hasAdminObjects())
{
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.admin.notApp",
"Resource Adapter does not define any administered objects"));
return result;
}
Set adminObjects = descriptor.getAdminObjects();
boolean oneFailed = false;
Iterator iter = adminObjects.iterator();
while(iter.hasNext())
{
AdminObject adminObj = (AdminObject) iter.next();
String intf = adminObj.getAdminObjectInterface();
String impl = adminObj.getAdminObjectClass();
Class implClass = null;
try
{
implClass = Class.forName(impl, false, getVerifierContext().getClassLoader());
}
catch(ClassNotFoundException e)
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.admin.nonexist",
"Error: The class [ {0} ] as defined under adminobject-class in the deployment descriptor does not exist",
new Object[] {impl}));
return result;
}
if(!isImplementorOf(implClass, intf))
{
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString(getClass().getName() + ".failed",
"Error: adminobject-class [ {0} ] does not implement adminobject-interface [ {1} ].",
new Object[] {impl, intf}));
return result;
}
}
if(!oneFailed)
{
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString(getClass().getName() + ".passed",
"Success: all adminobject-class implement their corresponding adminobject-interface"));
}
return result;