use of com.sun.enterprise.deployment.ConnectionDefDescriptor in project Payara by payara.
the class CCITest method isCCIImplemented.
/**
* <p>
* Checks whether the resource adapater is implementing the CCI interfaces
* </p>
* @param descriptor the deployment descriptor
* @param result to put the result
* @return true if the CCI is implemented
*/
protected boolean isCCIImplemented(ConnectorDescriptor descriptor, Result result) {
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
OutboundResourceAdapter outboundRA = descriptor.getOutboundResourceAdapter();
if (outboundRA == null) {
return false;
}
Set connDefs = outboundRA.getConnectionDefs();
Iterator iter = connDefs.iterator();
while (iter.hasNext()) {
ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) iter.next();
// check if intf implements javax.resource.cci.ConnectionFactory
String intf = connDefDesc.getConnectionFactoryIntf();
Class implClass = null;
try {
implClass = Class.forName(intf, 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.ConnectorTest.isClassLoadable.failed", "The class [ {0} ] is not contained in the archive file", new Object[] { intf }));
continue;
}
if (isImplementorOf(implClass, "javax.resource.cci.ConnectionFactory")) {
return true;
}
}
return false;
}
use of com.sun.enterprise.deployment.ConnectionDefDescriptor in project Payara by payara.
the class ConnectionFactoryTest method getConnectionFactoryImpl.
/**
* <p>
* Get the <code>Class</code> 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
* </p>
*
* @param descriptor the rar file deployment descriptor
* @param result instance to use to put the result of the test
* @return Class object for the connectionfactoryimpl-class that implements
* javax.resource.cci.ConnectionFactory
*/
protected Class getConnectionFactoryImpl(ConnectorDescriptor descriptor, Result result) {
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;
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getRarClassLoader();
return jcl.loadClass(className); */
}
use of com.sun.enterprise.deployment.ConnectionDefDescriptor in project Payara by payara.
the class ConnectionTest method getConnectionImpl.
/**
* <p>
* Get the <code>Class</code> object of the class declared as implementing
* the javax.resource.cci.Connection interface and declared in the
* archive deployment descriptors under the connection-impl-class
* </p>
*
* @param descriptor the rar file deployment descriptor
* @param result instance to use to put the result of the test
* @return Class object for the connectionimpl-class that implements
* javax.resource.cci.Connection
*/
protected Class getConnectionImpl(ConnectorDescriptor descriptor, Result result) {
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.getConnectionImpl();
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.ConnectionTest.nonexist", "Error: The class [ {0} ] as defined in the connection-impl-class deployment descriptor does not exist", new Object[] { impl }));
return null;
}
if (isImplementorOf(implClass, "javax.resource.cci.Connection"))
return implClass;
}
return null;
}
use of com.sun.enterprise.deployment.ConnectionDefDescriptor in project Payara by payara.
the class CheckConnectionFactoryImplClass method check.
/**
* <p>
* Test for each connection-definition, that "connection-impl-class"
* implements "connection-interface".
* </p>
*
* @ paramm descriptor deployment descriptor for the rar file
* @return result object containing the result of the individual test
* performed
*/
public Result check(ConnectorDescriptor descriptor) {
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.getConnectionFactoryIntf();
String connectionImpl = connDefDesc.getConnectionFactoryImpl();
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 connectionfactory-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: connectionfactory-impl-class [ {0} ] does not implement connectionfactory-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 connectionfactory-impl-class implement their corresponding connectionfactory-interface"));
}
return result;
}
use of com.sun.enterprise.deployment.ConnectionDefDescriptor in project Payara by payara.
the class CheckConnectionImplClass method check.
/**
* <p>
* Test for each connection-definition, that "connection-impl-class"
* implements "connection-interface".
* </p>
*
* @ paramm descriptor deployment descriptor for the rar file
* @return result object containing the result of the individual test
* performed
*/
public Result check(ConnectorDescriptor descriptor) {
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;
}
Aggregations