FileDocCategorySizeDatePackage
PersistenceType.javaAPI DocGlassfish v2 API4707Fri May 04 22:33:36 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.entity

PersistenceType

public class PersistenceType extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Entity Bean's Persistence management test. If the enterprise bean is a Entity Bean, the Bean provider must use the "persistence-type" element to declare whether the persistence management is performed by the enterprise bean or the container.

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Entity Bean's Persistence management test. If the enterprise bean is a Entity Bean, the Bean provider must use the "persistence-type" element to declare whether the persistence management 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 EjbEntityDescriptor) {
	    String persistence = 
		((EjbEntityDescriptor)descriptor).getPersistenceType();
	    if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistence) ||
		EjbEntityDescriptor.CONTAINER_PERSISTENCE.equals(persistence)) {
		result.addGoodDetails(smh.getLocalString
				      ("tests.componentNameConstructor",
				       "For [ {0} ]",
				       new Object[] {compName.toString()}));
		result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			       "[ {0} ] is valid persistence type.",
			       new Object[] {persistence}));
	    } 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 persistence type within bean [ {1} ].",
			       new Object[] {persistence, 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 \n {1} bean, but called with {2} bean.",
				  new Object[] {getClass(),"Entity","Session"}));
	    return result;
	}