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.lang.reflect.Method ; 40 import java.util.Iterator ; 41 import java.util.Set ; 42 43 50 public class CheckActivationSpecOverridesEquals 51 extends ConnectorTest 52 implements ConnectorCheck 53 { 54 55 64 public Result check(ConnectorDescriptor descriptor) { 65 66 Result result = getInitializedResult(); 67 ComponentNameConstructor compName = 68 getVerifierContext().getComponentNameConstructor(); 69 if(!descriptor.getInBoundDefined()) 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.messageinflow.notApp", 77 "Resource Adapter does not provide inbound communication")); 78 return result; 79 } 80 InboundResourceAdapter ra = descriptor.getInboundResourceAdapter(); 81 Set msgListeners = ra.getMessageListeners(); 82 boolean oneFailed = false; 83 Iterator iter = msgListeners.iterator(); 84 while(iter.hasNext()) 85 { 86 MessageListener msgListener = (MessageListener) iter.next(); 87 String impl = msgListener.getActivationSpecClass(); 88 Class implClass = null; 89 try 90 { 91 implClass = Class.forName(impl, false, getVerifierContext().getClassLoader()); 92 } 93 catch(ClassNotFoundException e) 94 { 95 result.addErrorDetails(smh.getLocalString 96 ("tests.componentNameConstructor", 97 "For [ {0} ]", 98 new Object [] {compName.toString()})); 99 result.failed(smh.getLocalString 100 ("com.sun.enterprise.tools.verifier.tests.connector.messageinflow.nonexist", 101 "Error: The class [ {0} ] as defined under activationspec-class in the deployment descriptor does not exist", 102 new Object [] {impl})); 103 return result; 104 } 105 try 106 { 107 Method equalsMethod = implClass.getMethod("equals", 108 new Class [] {implClass}); 109 oneFailed = true; 110 result.addErrorDetails(smh.getLocalString 111 ("tests.componentNameConstructor", 112 "For [ {0} ]", 113 new Object [] {compName.toString()})); 114 result.failed(smh.getLocalString(getClass().getName() + ".failed", 115 "Error: activationspec-class [ {0} ] overrides the equals method", 116 new Object [] {impl})); 117 return result; 118 } 119 catch(NoSuchMethodException e) 120 { 121 } 123 catch(SecurityException e) 124 { 125 } 126 } 127 if(!oneFailed) 128 { 129 result.addGoodDetails(smh.getLocalString 130 ("tests.componentNameConstructor", 131 "For [ {0} ]", 132 new Object [] {compName.toString()})); 133 result.passed(smh.getLocalString(getClass().getName() + ".passed", 134 "Success: all activationspec-class do not override the equals method")); 135 } 136 return result; 137 } 138 } 139 | Popular Tags |