1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector; 30 31 import java.io.File ; 32 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest; 33 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck; 34 import com.sun.enterprise.tools.verifier.Result; 35 import com.sun.enterprise.tools.verifier.*; 36 import com.sun.enterprise.deployment.ConnectorDescriptor; 37 import com.sun.enterprise.tools.verifier.tests.*; 38 import java.util.Iterator ; 39 import java.util.Set ; 40 41 48 public class CheckResourceAdapterClass 49 extends ConnectorTest 50 implements ConnectorCheck 51 { 52 53 62 public Result check(ConnectorDescriptor descriptor) { 63 64 Result result = getInitializedResult(); 65 ComponentNameConstructor compName = 66 getVerifierContext().getComponentNameConstructor(); 67 String resourceAdapterClass = descriptor.getResourceAdapterClass(); 68 if(resourceAdapterClass.equals("")) 69 { 70 if(descriptor.getInBoundDefined()) 71 { 72 result.addErrorDetails(smh.getLocalString 74 ("tests.componentNameConstructor", 75 "For [ {0} ]", 76 new Object [] {compName.toString()})); 77 result.failed(smh.getLocalString 78 (getClass().getName() + ".failed1", 79 "resourceadapter-class cannot be empty if the resource" + 80 " adapter provides inbound communication")); 81 } 82 else 83 { 84 result.addNaDetails(smh.getLocalString 85 ("tests.componentNameConstructor", 86 "For [ {0} ]", 87 new Object [] {compName.toString()})); 88 result.notApplicable(smh.getLocalString 89 ("com.sun.enterprise.tools.verifier.tests.connector.resourceadapter.notApp", 90 "resourceadapter-class is not specified.")); 91 } 92 return result; 93 } 94 Context context = getVerifierContext(); 95 ClassLoader jcl = context.getRarClassLoader(); 96 Class implClass = null; 97 try 98 { 99 implClass = Class.forName(resourceAdapterClass, false, getVerifierContext().getClassLoader()); 100 } 101 catch(ClassNotFoundException e) 102 { 103 result.addErrorDetails(smh.getLocalString 104 ("tests.componentNameConstructor", 105 "For [ {0} ]", 106 new Object [] {compName.toString()})); 107 result.failed(smh.getLocalString 108 ("com.sun.enterprise.tools.verifier.tests.connector." + 109 "CheckResourceAdapter.nonexist", 110 "Error: The class [ {0} ] as defined under resourceadapter-class " + "in the deployment descriptor does not exist", 111 new Object [] {resourceAdapterClass})); 112 return result; 113 } 114 if(!isImplementorOf(implClass, "javax.resource.spi.ResourceAdapter")) 115 { 116 result.addErrorDetails(smh.getLocalString 117 ("tests.componentNameConstructor", 118 "For [ {0} ]", 119 new Object [] {compName.toString()})); 120 result.failed(smh.getLocalString(getClass().getName() + ".failed", 121 "Error: resourceadapter-class [ {0} ] does not implement javax.resource.spi.ResourceAdapter", 122 new Object [] {resourceAdapterClass})); 123 } 124 else 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: resourceadapter-class implements javax.resource.spi.ResourceAdapter")); 132 } 133 return result; 134 } 135 } 136 | Popular Tags |