ConnectionFactoryTestpublic abstract class ConnectionFactoryTest extends CCITest Contains helper methods for all tests pertinent to the ConnectionFactory
interface or implementation classes. |
Methods Summary |
---|
protected java.lang.Class | getConnectionFactoryImpl(com.sun.enterprise.deployment.ConnectorDescriptor descriptor, Result result)
Get the Class object of the class declared as implementing
the javax.resource.cci.ConnectionFactory interface and declared in the
archive deployment descriptors under the connection-factory-impl-class
ComponentNameConstructor compName =
getVerifierContext().getComponentNameConstructor();
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();
String impl = connDefDesc.getConnectionFactoryImpl();
Class implClass = null;
try
{
implClass = Class.forName(impl, false, getVerifierContext().getClassLoader());
} catch(ClassNotFoundException cnfe) {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.cci.ConnectionFactoryTest.nonexist",
"Error: The class [ {0} ] as defined in the connectionfactory-impl-class deployment descriptor does not exist",
new Object[] {impl}));
return null;
}
if(isImplementorOf(implClass, "javax.resource.cci.ConnectionFactory"))
return implClass;
}
return null;
/*String className = descriptor.getConnectionFactoryImpl();
if (className == null)
return null;
Context context = getVerifierContext();
ClassLoader jcl = context.getRarClassLoader();
return jcl.loadClass(className); */
| protected java.lang.Class | testConnectionFactoryImpl(com.sun.enterprise.deployment.ConnectorDescriptor descriptor, Result result)
Test whether the class declared in the deployemnt descriptor under the
connectionfactory-impl-class tag is available
Class mcf = getConnectionFactoryImpl(descriptor, result);
if (mcf == null) {
ComponentNameConstructor compName =
getVerifierContext().getComponentNameConstructor();
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.connector.cci.ConnectionFactoryTest.nonimpl",
"Error: The resource adapter must implement the javax.resource.cci.ConnectionFactory interface and declare it in the connectionfactory-impl-class deployment descriptor."));
}
return mcf;
| 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
connectionfactory-impl-class tag implements an interface
Class mcf = testConnectionFactoryImpl(descriptor, result);
if (mcf != null)
return testImplementationOf(mcf, interfaceName, result);
return false;
|
|