1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.cci; 30 31 import com.sun.enterprise.tools.verifier.*; 32 import com.sun.enterprise.deployment.ConnectorDescriptor; 33 import com.sun.enterprise.deployment.OutboundResourceAdapter; 34 import com.sun.enterprise.deployment.ConnectionDefDescriptor; 35 import com.sun.enterprise.tools.verifier.tests.*; 36 import com.sun.enterprise.tools.verifier.tests.*; 37 import java.util.*; 38 39 46 public abstract class ConnectionTest extends CCITest { 47 48 60 protected Class getConnectionImpl(ConnectorDescriptor descriptor, 61 Result result) 62 { 63 ComponentNameConstructor compName = 64 getVerifierContext().getComponentNameConstructor(); 65 OutboundResourceAdapter outboundRA = 66 descriptor.getOutboundResourceAdapter(); 67 if(outboundRA == null) 68 { 69 return null; 70 } 71 Set connDefs = outboundRA.getConnectionDefs(); 72 Iterator iter = connDefs.iterator(); 73 while(iter.hasNext()) 74 { 75 ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) 76 iter.next(); 77 String impl = connDefDesc.getConnectionImpl(); 78 Class implClass = null; 79 try 80 { 81 implClass = Class.forName(impl, false, getVerifierContext().getClassLoader()); 82 } catch(ClassNotFoundException cnfe) { 83 result.addErrorDetails(smh.getLocalString 84 ("tests.componentNameConstructor", 85 "For [ {0} ]", 86 new Object [] {compName.toString()})); 87 result.failed(smh.getLocalString 88 ("com.sun.enterprise.tools.verifier.tests.connector.cci.ConnectionTest.nonexist", 89 "Error: The class [ {0} ] as defined in the connection-impl-class deployment descriptor does not exist", 90 new Object [] {impl})); 91 return null; 92 } 93 if(isImplementorOf(implClass, "javax.resource.cci.Connection")) 94 return implClass; 95 } 96 return null; 97 } 98 99 100 110 protected Class testConnectionImpl(ConnectorDescriptor descriptor, Result result) 111 { 112 Class mcf = getConnectionImpl(descriptor, result); 113 if (mcf == null) { 114 ComponentNameConstructor compName = 115 getVerifierContext().getComponentNameConstructor(); 116 result.addErrorDetails(smh.getLocalString 117 ("tests.componentNameConstructor", 118 "For [ {0} ]", 119 new Object [] {compName.toString()})); 120 result.failed(smh.getLocalString 121 ("com.sun.enterprise.tools.verifier.tests.connector.cci.ConnectionTest.nonimpl", 122 "Error: The resource adapter must implement the javax.resource.cci.Connection interface and declare it in the connection-impl-class deployment descriptor.")); 123 } 124 return mcf; 125 } 126 127 138 protected boolean testImplementationOf(ConnectorDescriptor descriptor, String interfaceName, Result result) 139 { 140 Class mcf = testConnectionImpl(descriptor, result); 141 if (mcf != null) 142 return testImplementationOf(mcf, interfaceName, result); 143 return false; 144 } 145 } 146 | Popular Tags |