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

SessionType

public class SessionType extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Session Bean State management test (stateful/stateless). If the enterprise bean is a Session Bean, the Bean provider must use the "session-type" element to declare whether the session bean is stateful or stateless.

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Session Bean State management test (stateful/stateless). If the enterprise bean is a Session Bean, the Bean provider must use the "session-type" element to declare whether the session bean is stateful or stateless.

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 stateType = ((EjbSessionDescriptor)descriptor).getSessionType();
	    if ((EjbSessionDescriptor.STATELESS.equals(stateType)) ||
		(EjbSessionDescriptor.STATEFUL.equals(stateType))) {
		result.addGoodDetails(smh.getLocalString
				      ("tests.componentNameConstructor",
				       "For [ {0} ]",
				       new Object[] {compName.toString()}));
			
		result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			       "[ {0} ] is valid stateType within bean [ {1} ].",
			       new Object[] {stateType,descriptor.getName()}));
	    } 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 stateType within bean [ {1} ].",
			       new Object[] {stateType, 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;
	}