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.Result; 33 import com.sun.enterprise.tools.verifier.Verifier; 34 import com.sun.enterprise.deployment.ConnectorDescriptor; 35 import com.sun.enterprise.tools.verifier.tests.*; 36 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 37 38 45 public class TransactionSupportExistence 46 extends ConnectorTest 47 implements ConnectorCheck 48 { 49 50 63 public Result check(ConnectorDescriptor descriptor) { 64 65 Result result = getInitializedResult(); 66 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 67 if(!descriptor.getOutBoundDefined()) 68 { 69 result.addNaDetails(smh.getLocalString 70 ("tests.componentNameConstructor", 71 "For [ {0} ]", 72 new Object [] {compName.toString()})); 73 result.notApplicable(smh.getLocalString 74 ("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA", 75 "Resource Adapter does not provide outbound communication")); 76 return result; 77 } 78 String connectorTransactionSupport = 79 descriptor.getOutboundResourceAdapter().getTransSupport(); 80 81 if (connectorTransactionSupport==null) { 83 result.addErrorDetails(smh.getLocalString 84 ("tests.componentNameConstructor", 85 "For [ {0} ]", 86 new Object [] {compName.toString()})); 87 result.failed(smh.getLocalString 88 ("com.sun.enterprise.tools.verifier.tests.connector.TransactionSupport.nonexist", 89 "Error: No Transaction support specified for ressource adapter", 90 new Object [] {connectorTransactionSupport})); 91 return result; 92 } 93 94 97 if (connectorTransactionSupport.equals(ConnectorTagNames.DD_NO_TRANSACTION)) { 99 boolean oneFailed=false; 100 if (findImplementorOf(descriptor, "javax.resource.spi.LocalTransaction")!=null) { 101 oneFailed = true; 102 result.addWarningDetails(smh.getLocalString 103 ("tests.componentNameConstructor", 104 "For [ {0} ]", 105 new Object [] {compName.toString()})); 106 result.warning(smh.getLocalString(getClass().getName() + ".warning", 107 "Warning: Transaction support {0} is specified for ressource adapter but [ {1} ] is implemented", 108 new Object [] {"NoTransaction", "javax.resource.spi.LocalTransaction"})); 109 } 110 if (findImplementorOf(descriptor, "javax.transaction.xa.XAResource")!=null) { 111 oneFailed = true; 112 result.addWarningDetails(smh.getLocalString 113 ("tests.componentNameConstructor", 114 "For [ {0} ]", 115 new Object [] {compName.toString()})); 116 result.warning(smh.getLocalString(getClass().getName() + ".warning", 117 "Warning: Transaction support {0} is specified for ressource adapter but [ {1} ] is implemented", 118 new Object [] {"NoTransaction", "javax.transaction.xa.XAResource"})); 119 } 120 if (!oneFailed) { 121 result.addGoodDetails(smh.getLocalString 122 ("tests.componentNameConstructor", 123 "For [ {0} ]", 124 new Object [] {compName.toString()})); 125 result.passed(smh.getLocalString(getClass().getName() + ".passed1", 126 "Transaction support NoTransaction is specified for ressource adapter and [ {0} ] are not implemented", 127 new Object [] {"javax.transaction.xa.XAResource, javax.resource.spi.LocalTransaction"})); 128 } 129 } 130 else { 131 if (connectorTransactionSupport.equals(ConnectorTagNames.DD_LOCAL_TRANSACTION)) { 132 if (findImplementorOf(descriptor, "javax.resource.spi.LocalTransaction")==null) { 133 result.addErrorDetails(smh.getLocalString 134 ("tests.componentNameConstructor", 135 "For [ {0} ]", 136 new Object [] {compName.toString()})); 137 result.failed(smh.getLocalString(getClass().getName() + ".nonexist", 138 "Error: Transaction support {0} is specified for ressource adapter but [ {1} ] is not implemented", 139 new Object [] {"LocalTransaction", "javax.resource.spi.LocalTransaction"})); 140 } else { 141 if (findImplementorOf(descriptor, "javax.transaction.xa.XAResource")!=null) { 142 result.addWarningDetails(smh.getLocalString 143 ("tests.componentNameConstructor", 144 "For [ {0} ]", 145 new Object [] {compName.toString()})); 146 result.addWarningDetails(smh.getLocalString(getClass().getName() + ".warning", 147 "Warning: Transaction support {0} is specified for ressource adapter but [ {1} ] is implemented", 148 new Object [] {"LocalTransaction", "javax.transaction.xa.XAResource"})); 149 } else { 150 result.addGoodDetails(smh.getLocalString 151 ("tests.componentNameConstructor", 152 "For [ {0} ]", 153 new Object [] {compName.toString()})); 154 result.passed(smh.getLocalString(getClass().getName() + ".passed2", 155 "Transaction support {0} is specified for ressource adapter and [ {1} ] is(are) implemented", 156 new Object [] {"LocalTransaction", "javax.resource.spi.LocalTransaction"})); 157 } 158 } 159 } else { 160 if (connectorTransactionSupport.equals(ConnectorTagNames.DD_XA_TRANSACTION)) { 161 boolean oneFailed = false; 162 if (findImplementorOf(descriptor, "javax.resource.spi.LocalTransaction")==null) { 163 oneFailed = true; 164 result.addErrorDetails(smh.getLocalString 165 ("tests.componentNameConstructor", 166 "For [ {0} ]", 167 new Object [] {compName.toString()})); 168 result.failed(smh.getLocalString(getClass().getName() + ".nonexist", 169 "Error: Transaction support {0} is specified for ressource adapter but [ {1} ] is not implemented", 170 new Object [] {"XATransaction", "javax.resource.spi.LocalTransaction"})); 171 } 172 if (findImplementorOf(descriptor, "javax.transaction.xa.XAResource")==null) { 173 oneFailed = true; 174 result.addErrorDetails(smh.getLocalString 175 ("tests.componentNameConstructor", 176 "For [ {0} ]", 177 new Object [] {compName.toString()})); 178 result.failed(smh.getLocalString(getClass().getName() + ".nonexist", 179 "Error: Transaction support {0} is specified for ressource adapter but [ {1} ] is not implemented", 180 new Object [] {"XATransaction", "javax.transaction.xa.XAResource"})); 181 } 182 if (!oneFailed) { 183 result.addGoodDetails(smh.getLocalString 184 ("tests.componentNameConstructor", 185 "For [ {0} ]", 186 new Object [] {compName.toString()})); 187 result.passed(smh.getLocalString(getClass().getName() + ".passed2", 188 "Transaction support {0} is specified for ressource adapter and [ {1} ] is(are) implemented", 189 new Object [] {"XATransaction", "javax.transaction.xa.Transaction, javax.resource.spi.LocalTransaction"})); 190 } 191 } else { 192 result.addErrorDetails(smh.getLocalString 194 ("tests.componentNameConstructor", 195 "For [ {0} ]", 196 new Object [] {compName.toString()})); 197 result.failed(smh.getLocalString 198 ("com.sun.enterprise.tools.verifier.tests.connector.TransactionSupport.failed", 199 "Error: Deployment descriptor transaction-support [ {0} ] for ressource adapter is not valid", 200 new Object [] {connectorTransactionSupport})); 201 } 202 } 203 } 204 return result; 205 } 206 } 207 | Popular Tags |