1 23 package com.sun.enterprise.tools.verifier.tests.ejb.session; 24 25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 31 32 38 public class TransactionTypeBeanManaged extends EjbTest implements EjbCheck { 39 40 41 51 public Result check(EjbDescriptor descriptor) { 52 53 Result result = getInitializedResult(); 54 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 55 56 String transactionType = descriptor.getTransactionType(); 57 if (EjbSessionDescriptor.BEAN_TRANSACTION_TYPE.equals(transactionType)) { 58 if (descriptor instanceof EjbSessionDescriptor) { 59 result.addGoodDetails(smh.getLocalString 60 ("tests.componentNameConstructor", 61 "For [ {0} ]", 62 new Object [] {compName.toString()})); 63 result.passed(smh.getLocalString 64 (getClass().getName() + ".passed", 65 "[ {0} ] is valid transactionType within Session bean [ {1} ]", 66 new Object [] {transactionType, descriptor.getName()})); 67 } else if (descriptor instanceof EjbEntityDescriptor) { 68 result.addErrorDetails(smh.getLocalString 69 ("tests.componentNameConstructor", 70 "For [ {0} ]", 71 new Object [] {compName.toString()})); 72 result.failed(smh.getLocalString 73 (getClass().getName() + ".failedException", 74 "Error: [ {0} ] is not valid transactionType within entity bean [ {1} ]", 75 new Object [] {transactionType, descriptor.getName()})); 76 } 77 return result; 78 } else if (EjbSessionDescriptor.CONTAINER_TRANSACTION_TYPE.equals(transactionType)) { 79 result.addNaDetails(smh.getLocalString 80 ("tests.componentNameConstructor", 81 "For [ {0} ]", 82 new Object [] {compName.toString()})); 83 result.notApplicable(smh.getLocalString 84 (getClass().getName() + ".notApplicable", 85 "Expected [ {0} ] transaction demarcation, but [ {1} ] bean has [ {2} ] transaction demarcation.", 86 new Object [] {EjbSessionDescriptor.BEAN_TRANSACTION_TYPE,descriptor.getName(),EjbSessionDescriptor.CONTAINER_TRANSACTION_TYPE})); 87 return result; 88 } else { 89 result.addNaDetails(smh.getLocalString 90 ("tests.componentNameConstructor", 91 "For [ {0} ]", 92 new Object [] {compName.toString()})); 93 result.notApplicable(smh.getLocalString 94 (getClass().getName() + ".notApplicable", 95 "Expected [ {0} ] transaction demarcation, but [ {1} ] bean has [ {2} ] transaction demarcation.", 96 new Object [] {EjbSessionDescriptor.BEAN_TRANSACTION_TYPE,descriptor.getName(),transactionType})); 97 return result; 98 } 99 } 100 } 101 | Popular Tags |