FileDocCategorySizeDatePackage
ASCmpMappingTest.javaAPI DocGlassfish v2 API6149Fri May 04 22:35:16 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.ias.cmpmapping

ASCmpMappingTest

public class ASCmpMappingTest extends EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)

	Result result = getInitializedResult();
	ComponentNameConstructor compName = new ComponentNameConstructor(descriptor);
        boolean oneFailed = false;
        boolean notApp = false;

        //<addition author="irfan@sun.com" [bug/rfe]-id="4715917" >
        /*Set keys = descriptor.getEjbBundleDescriptor().getIasCmpMappingsKeys();

        SunCmpMappings iasCmpMappings=null;
        String forPmConfig=null;*/
        SunCmpMappings iasCmpMappings = descriptor.getEjbBundleDescriptor().getIasCmpMappings();
        String forPmConfig = com.sun.enterprise.deployment.EjbBundleXmlReader.IAS_CMP_MAPPING_JAR_ENTRY;
        //</addition>

        SunCmpMapping[] allIasCmpMapping=null;
        SunCmpMapping iasCmpMapping=null;

        /////test vars
        String schema=null;


        //<addition author="irfan@sun.com" [bug/rfe]-id="4715917" >
        if(iasCmpMappings != null)
        {
        /*if(keys!=null && keys.size()>0)
        {
            Iterator it = keys.iterator();
            while(it.hasNext()) {

                forPmConfig=(String) it.next();
                iasCmpMappings= descriptor.getEjbBundleDescriptor().getIasCmpMappings(forPmConfig);*/
        //</addition>
                allIasCmpMapping=iasCmpMappings.getSunCmpMapping();

                for(int rep=0;rep<allIasCmpMapping.length;rep++){

                      iasCmpMapping=allIasCmpMapping[rep];

                      //test logic
                      schema=iasCmpMapping.getSchema();
                      if(validateSchema(schema)){

                      result.passed(smh.getLocalString(getClass().getName()+".passed",
                            "PASSED [AS-CMP-MAPPING] : schema [{0} ] is a valid entry, in the mapping file [ {1}], "+
                            "of the ejb archive [ {2} ]. ",
                            new Object[]{schema,forPmConfig,descriptor.getName()}));


                      }else{
                      oneFailed = true;

                      result.failed(smh.getLocalString(getClass().getName()+".failed",
                            "FAILED [AS-CMP-MAPPING] : schema [{0} ] is  NOT a valid entry, in the mapping file [ {1}], "+
                            "of the ejb archive [ {2} ]. "+
                            "Either  null or empty.",
                            new Object[]{schema,forPmConfig,descriptor.getName()}));


                      }



                }


            //} 4715917 irfan

        }
        else
        {
            notApp = true;
            result.notApplicable(smh.getLocalString
                                 (getClass().getName() + ".notApplicable",
                                  "NOT APPLICABLE [AS-CMP-MAPPING] : There is no ias-cmp-mappings file present, within the ejb archive [ {0} ].",
                                  new Object[] {descriptor.getName()}));

        }

        if (oneFailed) {
            result.setStatus(Result.FAILED);
        } else if(notApp) {
            result.setStatus(Result.NOT_APPLICABLE);
        }else {
            result.setStatus(Result.PASSED);
        }


        return result;
    
booleanvalidateSchema(java.lang.String schema)

        boolean valid=false;
        if(schema !=null && !schema.trim().equals("")){
            valid =true;
        }
        return valid;