1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.managed; 30 31 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest; 32 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck; 33 import com.sun.enterprise.tools.verifier.Result; 34 import com.sun.enterprise.tools.verifier.*; 35 import com.sun.enterprise.deployment.ConnectorDescriptor; 36 import com.sun.enterprise.deployment.ConnectionDefDescriptor; 37 import com.sun.enterprise.deployment.OutboundResourceAdapter; 38 import com.sun.enterprise.tools.verifier.tests.*; 39 import java.util.Iterator ; 40 import java.util.Set ; 41 42 49 public class CheckConnectionFactoryImplSerializable 50 extends ConnectorTest 51 implements ConnectorCheck 52 { 53 54 63 public Result check(ConnectorDescriptor descriptor) { 64 65 Result result = getInitializedResult(); 66 ComponentNameConstructor compName = 67 getVerifierContext().getComponentNameConstructor(); 68 if(!descriptor.getOutBoundDefined()) 70 { 71 result.addNaDetails(smh.getLocalString 72 ("tests.componentNameConstructor", 73 "For [ {0} ]", 74 new Object [] {compName.toString()})); 75 result.notApplicable(smh.getLocalString 76 ("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA", 77 "Resource Adapter does not provide outbound communication")); 78 return result; 79 } 80 OutboundResourceAdapter outboundRA = 81 descriptor.getOutboundResourceAdapter(); 82 if(outboundRA == null) 83 { 84 return null; 85 } 86 boolean oneFailed = false; 87 Set connDefs = outboundRA.getConnectionDefs(); 88 Iterator iter = connDefs.iterator(); 89 while(iter.hasNext()) 90 { 91 ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) 92 iter.next(); 93 String connectionImpl = connDefDesc.getConnectionFactoryImpl(); 94 Class implClass = null; 95 try 96 { 97 implClass = Class.forName(connectionImpl, false, getVerifierContext().getClassLoader()); 98 } 99 catch(ClassNotFoundException e) 100 { 101 result.addErrorDetails(smh.getLocalString 102 ("tests.componentNameConstructor", 103 "For [ {0} ]", 104 new Object [] {compName.toString()})); 105 result.failed(smh.getLocalString 106 (getClass().getName() + ".nonexist", 107 "Error: The class [ {0} ] as defined under connectionfactory-impl-class in the deployment descriptor does not exist", 108 new Object [] {connectionImpl})); 109 return result; 110 } 111 if(!isImplementorOf(implClass, "java.io.Serializable")) 112 { 113 oneFailed = true; 114 result.addErrorDetails(smh.getLocalString 115 ("tests.componentNameConstructor", 116 "For [ {0} ]", 117 new Object [] {compName.toString()})); 118 result.failed(smh.getLocalString(getClass().getName() + ".failed", 119 "Error: connectionfactory-impl-class [ {0} ] does not implement java.io.Serializable", 120 new Object [] {implClass.getName()})); 121 return result; 122 } 123 } 124 if(!oneFailed) 125 { 126 result.addGoodDetails(smh.getLocalString 127 ("tests.componentNameConstructor", 128 "For [ {0} ]", 129 new Object [] {compName.toString()})); 130 result.passed(smh.getLocalString(getClass().getName() + ".passed", 131 "Success: all connectionfactory-impl-class implement java.io.Serializable")); 132 } 133 return result; 134 } 135 } 136 | Popular Tags |