FileDocCategorySizeDatePackage
CmpFieldTest.javaAPI DocGlassfish v2 API4586Fri May 04 22:33:40 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2

CmpFieldTest

public abstract class CmpFieldTest extends CMPTest
Container-managed persistent fields related tests superclass
author
Jerome Dochez
version

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbCMPEntityDescriptor descriptor)
Container-managed persistent fields test, iterates over all declared cmp fields and invoke the runIndividualCmpFieldTest nethod

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


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

        Class c = loadEjbClass(descriptor, result);
        if (c!=null) {
            Descriptor persistentField;
	    boolean oneFailed = false;
            
            Set persistentFields = descriptor.getPersistenceDescriptor().getCMPFields();
            Iterator iterator = persistentFields.iterator();
	    if (iterator.hasNext()) {	  	
		while (iterator.hasNext()) {
		    persistentField = (Descriptor)iterator.next();
		    boolean status  = runIndividualCmpFieldTest(descriptor, persistentField, c, result);
		    if (!status) 
			oneFailed=true;                       
		    
		}
		if (oneFailed) {
		    result.setStatus(Result.FAILED);
		} else { 
		    result.setStatus(Result.PASSED);
		}
	    }	    
	    else { 
		result.addNaDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.notApplicable(smh.getLocalString
				     ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CmpFieldTest.notApplicable",
				      "Not Applicable : The EJB has no CMP fields declared",
				      new Object[] {})); 
	    }
	} 
        return result;
    
protected abstract booleanrunIndividualCmpFieldTest(Descriptor entity, Descriptor f, java.lang.Class c, com.sun.enterprise.tools.verifier.Result r)
run an individual verifier test of a declated cmp field of the class

param
entity the descriptor for the entity bean containing the cmp-field
param
f the descriptor for the declared cmp field
param
c the class owning the cmp field
parma
r the result object to use to put the test results in
return
true if the test passed