1 23 28 29 package com.sun.enterprise.tools.verifier.tests.connector.cci; 30 31 import java.io.File ; 32 import java.beans.*; 33 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck; 34 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest; 35 import com.sun.enterprise.tools.verifier.tests.*; 36 import com.sun.enterprise.tools.verifier.*; 37 import com.sun.enterprise.deployment.ConnectorDescriptor; 38 39 44 public class InteractionSpecJavaBeansCompliance extends ConnectionFactoryTest implements ConnectorCheck { 45 46 47 56 public Result check(ConnectorDescriptor descriptor) { 57 58 boolean oneFailed=false; 59 Result result = getInitializedResult(); 60 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 61 62 if (isCCIImplemented(descriptor, result)) { 63 Class mcf = findImplementorOf(descriptor, "javax.resource.cci.InteractionSpec"); 66 if (mcf != null) { 67 try { 68 BeanInfo bi = Introspector.getBeanInfo(mcf, Object .class); 69 PropertyDescriptor[] properties = bi.getPropertyDescriptors(); 70 for (int i=0; i<properties.length;i++) { 71 if (properties[i].getReadMethod()==null || 73 properties[i].getWriteMethod()==null) { 74 oneFailed=true; 76 result.addErrorDetails(smh.getLocalString 77 ("tests.componentNameConstructor", 78 "For [ {0} ]", 79 new Object [] {compName.toString()})); 80 result.failed(smh.getLocalString 81 (getClass().getName() + ".failed", 82 "Error: The javax.resource.cci.InteractionSpec implementation [ {0} ] of the property [ {1} ] is not JavaBeans compliant", 83 new Object [] {mcf.getName(), properties[i].getName()} )); 84 } 85 if (!properties[i].isConstrained() && !properties[i].isBound()) { 86 oneFailed=true; 87 result.addErrorDetails(smh.getLocalString 88 ("tests.componentNameConstructor", 89 "For [ {0} ]", 90 new Object [] {compName.toString()})); 91 result.failed(smh.getLocalString 92 (getClass().getName() + ".failed2", 93 "Error: The property [ {0} ] of the javax.resource.cci.InteractionSpec implementation [ {1} ] is not bound or constrained", 94 new Object [] {properties[i].getName(), mcf.getName()} )); 95 } 96 } 97 } catch (IntrospectionException ie) { 98 result.addNaDetails(smh.getLocalString 99 ("tests.componentNameConstructor", 100 "For [ {0} ]", 101 new Object [] {compName.toString()})); 102 result.notApplicable(smh.getLocalString 103 (getClass().getName() + ".failed", 104 "Error: The javax.resource.cci.InteractionSpec implementation [ {0} ] is not JavaBeans compliant", 105 new Object [] {mcf.getName()} )); 106 return result; 107 } 108 } else { 110 result.addNaDetails(smh.getLocalString 111 ("tests.componentNameConstructor", 112 "For [ {0} ]", 113 new Object [] {compName.toString()})); 114 result.notApplicable(smh.getLocalString 115 (getClass().getName() + ".nonexist", 116 "Error: While the CCI interfaces are implemented, the javax.resource.cci.InteractionSpec is not")); 117 return result; 118 } 119 120 } else { 121 result.addNaDetails(smh.getLocalString 122 ("tests.componentNameConstructor", 123 "For [ {0} ]", 124 new Object [] {compName.toString()})); 125 result.notApplicable(smh.getLocalString 126 ("com.sun.enterprise.tools.verifier.tests.connector.cci.InteractionExistence.notapp", 127 "NotApplicable : The CCI interfaces do not seem to be implemented by this resource adapter")); 128 return result; 129 } 130 if (!oneFailed) { 131 result.addGoodDetails(smh.getLocalString 132 ("tests.componentNameConstructor", 133 "For [ {0} ]", 134 new Object [] {compName.toString()})); 135 result.passed(smh.getLocalString 136 (getClass().getName() + ".passed", 137 "The javax.resource.cci.InteractionSpec implementation is JavaBeans compliant")); 138 } 139 return result; 140 } 141 } 142 | Popular Tags |