1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.managed; 30 31 import java.util.*; 32 import java.lang.reflect.Method ; 33 import com.sun.enterprise.deployment.ConnectorDescriptor; 34 import com.sun.enterprise.tools.verifier.tests.*; 35 import com.sun.enterprise.deployment.EnvironmentProperty; 36 import com.sun.enterprise.tools.verifier.Result; 37 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck; 38 39 import com.sun.enterprise.deployment.ConnectionDefDescriptor; 40 import com.sun.enterprise.deployment.OutboundResourceAdapter; 41 42 53 public class ManagedConnectionFactoryProperties 54 extends ManagedConnectionFactoryTest 55 implements ConnectorCheck 56 { 57 70 public Result check(ConnectorDescriptor descriptor) { 71 72 Result result = getInitializedResult(); 73 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 74 if(!descriptor.getOutBoundDefined()) 76 { 77 result.addNaDetails(smh.getLocalString 78 ("tests.componentNameConstructor", 79 "For [ {0} ]", 80 new Object [] {compName.toString()})); 81 result.notApplicable(smh.getLocalString 82 ("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA", 83 "Resource Adapter does not provide outbound communication")); 84 return result; 85 } 86 boolean oneFailed=false; 87 OutboundResourceAdapter outboundRA = 88 descriptor.getOutboundResourceAdapter(); 89 90 Set connDefs = outboundRA.getConnectionDefs(); 91 Iterator iter = connDefs.iterator(); 92 while(iter.hasNext()) { 93 94 ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) 95 iter.next(); 96 Set configProperties = connDefDesc.getConfigProperties(); 97 if (!configProperties.isEmpty()) { 98 Iterator propIterator = configProperties.iterator(); 99 Class mcf = testManagedConnectionFactoryImpl(descriptor, result); 100 if (mcf == null) { 101 return result; 104 } 105 while (propIterator.hasNext()) { 106 EnvironmentProperty ep = (EnvironmentProperty) propIterator.next(); 107 108 String propertyName = Character.toUpperCase(ep.getName().charAt(0)) + ep.getName().substring(1); 110 String setMethodName = "set" + propertyName; 111 Class [] parmTypes = new Class [] { ep.getValueType() }; 112 Method m = getMethod(mcf, setMethodName, parmTypes); 113 if (m!=null) { 114 result.addGoodDetails(smh.getLocalString 115 ("tests.componentNameConstructor", 116 "For [ {0} ]", 117 new Object [] {compName.toString()})); 118 result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", 119 "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]", 120 new Object [] { m, ep.getName()})); 121 } else { 122 oneFailed=true; 123 result.addErrorDetails(smh.getLocalString 124 ("tests.componentNameConstructor", 125 "For [ {0} ]", 126 new Object [] {compName.toString()})); 127 result.addErrorDetails(smh.getLocalString 128 (getClass().getName() + ".failed", 129 "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]", 130 new Object [] { "public void "+ setMethodName+"("+ep.getValueType().getName()+")", 131 mcf.getName(), 132 ep.getName()})); 133 } 134 String getMethodName = "get" + propertyName; 135 m = getMethod(mcf, getMethodName, null); 136 if (m!=null) { 137 result.addGoodDetails(smh.getLocalString 138 ("tests.componentNameConstructor", 139 "For [ {0} ]", 140 new Object [] {compName.toString()})); 141 result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", 142 "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]", 143 new Object [] { m, ep.getName()})); 144 } else { 145 oneFailed=true; 146 result.addErrorDetails(smh.getLocalString 147 ("tests.componentNameConstructor", 148 "For [ {0} ]", 149 new Object [] {compName.toString()})); 150 result.addErrorDetails(smh.getLocalString 151 (getClass().getName() + ".failed", 152 "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]", 153 new Object [] { "public " + ep.getValueType().getName() + " " + getMethodName, 154 mcf.getName(), 155 ep.getName()})); 156 } 157 } 158 } 159 } 160 if (oneFailed) { 161 result.setStatus(Result.FAILED); 162 } else { 163 result.setStatus(Result.PASSED); 164 } 165 return result; 166 } 167 } 168 | Popular Tags |