Test that the return type of
javax.resource.spi.ManagedConnection.getMetaData() implements
the ManagedConnectionMetaData 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;
}
//File jarFile = Verifier.getJarFile(descriptor.getModuleDescriptor().getArchiveUri());
// File f=Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
Class c = findImplementorOf(descriptor, "javax.resource.spi.ManagedConnection");
if(c == null)
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest.findImplementor.failed",
"Error: There is no implementation of the [ {0} ] provided",
new Object[] {"javax.resource.spi.ManagedConnection"}));
return result;
}
// get return type of getMetaData()
Method m = null;
do {
try {
m = c.getMethod("getMetaData", (Class[])null);
} catch(NoSuchMethodException nsme) {
} catch(SecurityException se) {
}
c = c.getSuperclass();
} while (m != null && c != Object.class);
if(m == null)
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.failed",
"Error: There is no implementation of getMetaData() provided"));
return result;
}
Class returnType = m.getReturnType();
if(VerifierTest.isImplementorOf(returnType,
"javax.resource.spi.ManagedConnectionMetaData"))
{
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.passed",
"ManagedConnection.getMetaData() returns an instance of the" +
"javax.resource.spi.ManagedConnectionMetaData interface"));
}
else
{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.failed1",
"Error: getMetaData() does not return an instance of the" +
"javax.resource.spi.ManagedConnectionMetaData interface"));
}
return result;