ManagedConnectionFactoryTestpublic abstract class ManagedConnectionFactoryTest extends com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest Superclass for all ManagedConnectionFactory related tests |
Fields Summary |
---|
private String | managedConnectionFactoryImpl |
Methods Summary |
---|
protected java.lang.Class | getManagedConnectionFactoryImpl(com.sun.enterprise.deployment.ConnectorDescriptor descriptor)
Get the Class object of the class declared to be implementing
the javax.resource.spi.ManagedConnectionFactory interface in the
archive deployment descriptor
OutboundResourceAdapter outboundRA =
descriptor.getOutboundResourceAdapter();
if(outboundRA == null)
{
return null;
}
Set connDefs = outboundRA.getConnectionDefs();
Iterator iter = connDefs.iterator();
while(iter.hasNext())
{
ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor)
iter.next();
managedConnectionFactoryImpl =
connDefDesc.getManagedConnectionFactoryImpl();
Class implClass = Class.forName(managedConnectionFactoryImpl, false, getVerifierContext().getClassLoader());
if(isImplementorOf(implClass, "javax.resource.spi.ManagedConnectionFactory"))
{
return implClass;
}
}
return null;
/* String className = descriptor.getManagedConnectionFactoryImpl();
if (className == null)
return null;
Context context = getVerifierContext();
ClassLoader jcl = context.getRarClassLoader();
return jcl.loadClass(className); */
| protected boolean | testImplementationOf(com.sun.enterprise.deployment.ConnectorDescriptor descriptor, java.lang.String interfaceName, Result result)
Test wether the class declared in the deployemnt descriptor under the
managedconnecttionfactory-class tag implements an interface
Class mcf = testManagedConnectionFactoryImpl(descriptor, result);
if (mcf != null)
return testImplementationOf(mcf, interfaceName, result);
return false;
| protected java.lang.Class | testManagedConnectionFactoryImpl(com.sun.enterprise.deployment.ConnectorDescriptor descriptor, Result result)
Test whether the class declared in the deployemnt descriptor under the
managedconnecttionfactory-class tag is available
Class mcf = null;
ComponentNameConstructor compName = null;
try {
compName = getVerifierContext().getComponentNameConstructor();
mcf = getManagedConnectionFactoryImpl(descriptor);
if (mcf == 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.ManagedConnectionFactoryTest.nonimpl",
"Error: The resource adapter must implement the javax.resource.spi.ManagedConnectionFactory interface and declare it in the managedconnecttionfactory-class deployment descriptor."));
}
} catch(ClassNotFoundException cnfe) {
cnfe.printStackTrace();
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionFactoryTest.nonexist",
"Error: The class [ {0} ] as defined in the managedconnecttionfactory-class deployment descriptor does not exist",
new Object[] {managedConnectionFactoryImpl}));
}
return mcf;
|
|