Test for each connection-definition, that "connection-impl-class"
implements "connection-interface".
Result result = getInitializedResult();
ComponentNameConstructor compName =
getVerifierContext().getComponentNameConstructor();
// test NA for inboundRA
if(!descriptor.getOutBoundDefined())
{
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA",
"Resource Adapter does not provide outbound communication"));
return result;
}
OutboundResourceAdapter outboundRA =
descriptor.getOutboundResourceAdapter();
if(outboundRA == null)
{
return null;
}
boolean oneFailed = false;
Set connDefs = outboundRA.getConnectionDefs();
Iterator iter = connDefs.iterator();
while(iter.hasNext())
{
ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor)
iter.next();
String connectionInterface = connDefDesc.getConnectionIntf();
String connectionImpl = connDefDesc.getConnectionImpl();
Class implClass = null;
try
{
implClass = Class.forName(connectionImpl, false, getVerifierContext().getClassLoader());
}
catch(ClassNotFoundException e)
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".nonexist",
"Error: The class [ {0} ] as defined under connection-impl-class in the deployment descriptor does not exist",
new Object[] {connectionImpl}));
return result;
}
if(!isImplementorOf(implClass, connectionInterface))
{
oneFailed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString(getClass().getName() + ".failed",
"Error: connection-impl-class [ {0} ] does not implement connection-interface [ {1} ].",
new Object[] {implClass.getName(), connectionInterface}));
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 connection-impl-class implement their corresponding connection-interface"));
}
return result;