FileDocCategorySizeDatePackage
TransactionType.javaAPI DocGlassfish v2 API4729Fri May 04 22:34:06 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.session

TransactionType

public class TransactionType extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Session Bean's Transaction demarcation test. If the enterprise bean is a Session Bean, the Bean provider must use the "transaction-type" element to declare whether the transaction demarcation is performed by the enterprise bean or the container.

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Session Bean's Transaction demarcation test. If the enterprise bean is a Session Bean, the Bean provider must use the "transaction-type" element to declare whether the transaction demarcation is performed by the enterprise bean or the container.

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	if (descriptor instanceof EjbSessionDescriptor) {
	    String transactionType = descriptor.getTransactionType();
	    if (EjbSessionDescriptor.BEAN_TRANSACTION_TYPE.equals(transactionType) ||
		EjbSessionDescriptor.CONTAINER_TRANSACTION_TYPE.equals(transactionType)) {
		result.addGoodDetails(smh.getLocalString
				      ("tests.componentNameConstructor",
				       "For [ {0} ]",
				       new Object[] {compName.toString()}));
						
		result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			       "[ {0} ] is valid transactionType.",
			       new Object[] {transactionType}));
	    } else {
		result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.failed(smh.getLocalString
			      (getClass().getName() + ".failed",
			       "Error: [ {0} ] is not valid transactionType within bean [ {1} ].",
			       new Object[] {transactionType, descriptor.getName()}));
	    } 
	    return result;
	} else {
	    result.addNaDetails(smh.getLocalString
				("tests.componentNameConstructor",
				 "For [ {0} ]",
				 new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
				 (getClass().getName() + ".notApplicable",
				  "[ {0} ] expected {1} bean, but called with {2} bean.",
				  new Object[] {getClass(),"Session","Entity"}));
	    return result;
	}