FileDocCategorySizeDatePackage
AbstractPersistenceUnitCount.javaAPI DocGlassfish v2 API3629Fri May 04 22:33:26 BST 2007com.sun.enterprise.tools.verifier.tests

AbstractPersistenceUnitCount

public abstract class AbstractPersistenceUnitCount extends VerifierTest implements VerifierCheck
Assertion : persistemce.xml should have atleast one persistence unit.
author
bshankar@sun.com

Fields Summary
static final String
className
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(Descriptor descriptor)

    
        
        
        RootDeploymentDescriptor rootDescriptor = getRootDescriptor(descriptor);
        
        Result result = getInitializedResult();
        addErrorDetails(result,
                getVerifierContext().getComponentNameConstructor());
        result.setStatus(Result.PASSED); //default status is PASSED
        
        if(rootDescriptor.getPersistenceUnitsDescriptors().size() == 0)
            result.setStatus(Result.NOT_APPLICABLE);
        
        for(PersistenceUnitsDescriptor pus : rootDescriptor.getPersistenceUnitsDescriptors()) {
            if (pus.getPersistenceUnitDescriptors().size() == 0) {
                result.failed(
                        smh.getLocalString(
                        className + ".failed",
                        "persistence.xml in persistence unit root [ {0} ] has no persistence units.",
                        new Object[]{pus.getPuRoot()}));
            }
        }
        return result;
    
protected abstract RootDeploymentDescriptorgetRootDescriptor(Descriptor descriptor)