1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.messageinflow; 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.InboundResourceAdapter; 37 import com.sun.enterprise.deployment.MessageListener; 38 import com.sun.enterprise.tools.verifier.tests.*; 39 import java.util.Iterator ; 40 import java.util.Set ; 41 42 49 public class CheckActivationSpecClass 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.getInBoundDefined()) 69 { 70 result.addNaDetails(smh.getLocalString 71 ("tests.componentNameConstructor", 72 "For [ {0} ]", 73 new Object [] {compName.toString()})); 74 result.notApplicable(smh.getLocalString 75 ("com.sun.enterprise.tools.verifier.tests.connector.messageinflow.notApp", 76 "Resource Adapter does not provide inbound communication")); 77 return result; 78 } 79 InboundResourceAdapter ra = descriptor.getInboundResourceAdapter(); 80 Set msgListeners = ra.getMessageListeners(); 81 boolean oneFailed = false; 82 Iterator iter = msgListeners.iterator(); 83 while(iter.hasNext()) 84 { 85 MessageListener msgListener = (MessageListener) iter.next(); 86 String impl = msgListener.getActivationSpecClass(); 87 Class implClass = null; 88 try 89 { 90 implClass = Class.forName(impl, false, getVerifierContext().getClassLoader()); 91 } 92 catch(ClassNotFoundException e) 93 { 94 result.addErrorDetails(smh.getLocalString 95 ("tests.componentNameConstructor", 96 "For [ {0} ]", 97 new Object [] {compName.toString()})); 98 result.failed(smh.getLocalString 99 ("com.sun.enterprise.tools.verifier.tests.connector.messageinflow.nonexist", 100 "Error: The class [ {0} ] as defined under activationspec-class in the deployment descriptor does not exist", 101 new Object [] {impl})); 102 return result; 103 } 104 if(!isImplementorOf(implClass, "javax.resource.spi.ActivationSpec")) 105 { 106 oneFailed = true; 107 result.addErrorDetails(smh.getLocalString 108 ("tests.componentNameConstructor", 109 "For [ {0} ]", 110 new Object [] {compName.toString()})); 111 result.failed(smh.getLocalString(getClass().getName() + ".failed", 112 "Error: activationspec-class [ {0} ] does not implement javax.resource.spi.ActivationSpec.", 113 new Object [] {impl})); 114 return result; 115 } 116 } 117 if(!oneFailed) 118 { 119 result.addGoodDetails(smh.getLocalString 120 ("tests.componentNameConstructor", 121 "For [ {0} ]", 122 new Object [] {compName.toString()})); 123 result.passed(smh.getLocalString(getClass().getName() + ".passed", 124 "Success: all activationspec-class implement javax.resource.spi.ActivationSpec")); 125 } 126 return result; 127 } 128 } 129 | Popular Tags |