1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.cci; 30 31 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest; 32 import com.sun.enterprise.tools.verifier.*; 33 import com.sun.enterprise.deployment.ConnectorDescriptor; 34 import com.sun.enterprise.deployment.ConnectionDefDescriptor; 35 import com.sun.enterprise.deployment.OutboundResourceAdapter; 36 import com.sun.enterprise.tools.verifier.tests.*; 37 import java.lang.ClassLoader ; 38 import java.util.Iterator ; 39 import java.util.Set ; 40 46 public abstract class CCITest extends ConnectorTest { 47 48 56 protected boolean isCCIImplemented(ConnectorDescriptor descriptor, 57 Result result) { 58 ComponentNameConstructor compName = 59 getVerifierContext().getComponentNameConstructor(); 60 OutboundResourceAdapter outboundRA = 61 descriptor.getOutboundResourceAdapter(); 62 if(outboundRA == null) 63 { 64 return false; 65 } 66 Set connDefs = outboundRA.getConnectionDefs(); 67 Iterator iter = connDefs.iterator(); 68 while(iter.hasNext()) 69 { 70 ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) 71 iter.next(); 72 String intf = connDefDesc.getConnectionFactoryIntf(); 74 Class implClass = null; 75 try 76 { 77 implClass = Class.forName(intf, false, getVerifierContext().getClassLoader()); 78 } 79 catch(ClassNotFoundException e) 80 { 81 result.addErrorDetails(smh.getLocalString 82 ("tests.componentNameConstructor", 83 "For [ {0} ]", 84 new Object [] {compName.toString()})); 85 result.failed(smh.getLocalString 86 ("com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest.isClassLoadable.failed", 87 "The class [ {0} ] is not contained in the archive file", 88 new Object [] {intf})); 89 continue; 90 } 91 if(isImplementorOf(implClass, "javax.resource.cci.ConnectionFactory")) 92 { 93 return true; 94 } 95 } 96 return false; 97 } 98 99 100 109 protected String getConnectionInterface(ConnectorDescriptor descriptor, 110 Result result) 111 { 112 ComponentNameConstructor compName = 113 getVerifierContext().getComponentNameConstructor(); 114 OutboundResourceAdapter outboundRA = 115 descriptor.getOutboundResourceAdapter(); 116 if(outboundRA == null) 117 { 118 return null; 119 } 120 Set connDefs = outboundRA.getConnectionDefs(); 121 Iterator iter = connDefs.iterator(); 122 while(iter.hasNext()) 123 { 124 ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) 125 iter.next(); 126 String intf = connDefDesc.getConnectionIntf(); 127 Context context = getVerifierContext(); 128 ClassLoader jcl = context.getRarClassLoader(); 129 Class intfClass = null; 130 try 131 { 132 intfClass = Class.forName(intf, false, getVerifierContext().getClassLoader()); 133 } 134 catch(ClassNotFoundException e) 135 { 136 result.addErrorDetails(smh.getLocalString 137 ("tests.componentNameConstructor", 138 "For [ {0} ]", 139 new Object [] {compName.toString()})); 140 result.failed(smh.getLocalString 141 ("com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest.isClassLoadable.failed", 142 "The class [ {0} ] is not contained in the archive file", 143 new Object [] {intf})); 144 continue; 145 } 146 if(isImplementorOf(intfClass, "javax.resource.cci.Connection")) 147 { 148 return intf; 149 } 150 } 151 return null; 152 } 153 154 } 155 | Popular Tags |