1 23 24 package com.sun.enterprise.tools.verifier.tests.ejb.ias.cmpmapping; 25 26 27 import java.util.*; 28 import com.sun.enterprise.deployment.EjbDescriptor; 29 import com.sun.enterprise.deployment.EjbSessionDescriptor; 30 import com.sun.enterprise.tools.verifier.*; 31 import com.sun.enterprise.tools.verifier.tests.*; 32 33 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck; 34 35 import com.sun.enterprise.tools.common.dd.ejb.SunEjbJar; 36 import com.sun.enterprise.tools.common.dd.ejb.Ejb; 37 import com.sun.enterprise.tools.common.dd.ResourceRef; 38 import com.sun.enterprise.tools.common.dd.DefaultResourcePrincipal; 39 import com.sun.enterprise.deployment.ResourceReferenceDescriptor; 40 import com.sun.enterprise.tools.verifier.tests.ejb.*; 41 import com.sun.enterprise.tools.common.dd.cmpmapping.*; 42 43 public class ASCmpMappingTest extends EjbTest implements EjbCheck { 44 45 public Result check(EjbDescriptor descriptor) 46 { 47 Result result = getInitializedResult(); 48 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 49 boolean oneFailed = false; 50 boolean notApp = false; 51 52 57 SunCmpMappings iasCmpMappings = descriptor.getEjbBundleDescriptor().getIasCmpMappings(); 58 String forPmConfig = com.sun.enterprise.deployment.EjbBundleXmlReader.IAS_CMP_MAPPING_JAR_ENTRY; 59 61 SunCmpMapping[] allIasCmpMapping=null; 62 SunCmpMapping iasCmpMapping=null; 63 64 String schema=null; 66 67 68 if(iasCmpMappings != null) 70 { 71 78 allIasCmpMapping=iasCmpMappings.getSunCmpMapping(); 80 81 for(int rep=0;rep<allIasCmpMapping.length;rep++){ 82 83 iasCmpMapping=allIasCmpMapping[rep]; 84 85 schema=iasCmpMapping.getSchema(); 87 if(validateSchema(schema)){ 88 89 result.passed(smh.getLocalString(getClass().getName()+".passed", 90 "PASSED [AS-CMP-MAPPING] : schema [{0} ] is a valid entry, in the mapping file [ {1}], "+ 91 "of the ejb archive [ {2} ]. ", 92 new Object []{schema,forPmConfig,descriptor.getName()})); 93 94 95 }else{ 96 oneFailed = true; 97 98 result.failed(smh.getLocalString(getClass().getName()+".failed", 99 "FAILED [AS-CMP-MAPPING] : schema [{0} ] is NOT a valid entry, in the mapping file [ {1}], "+ 100 "of the ejb archive [ {2} ]. "+ 101 "Either null or empty.", 102 new Object []{schema,forPmConfig,descriptor.getName()})); 103 104 105 } 106 107 108 109 } 110 111 112 114 } 115 else 116 { 117 notApp = true; 118 result.notApplicable(smh.getLocalString 119 (getClass().getName() + ".notApplicable", 120 "NOT APPLICABLE [AS-CMP-MAPPING] : There is no ias-cmp-mappings file present, within the ejb archive [ {0} ].", 121 new Object [] {descriptor.getName()})); 122 123 } 124 125 if (oneFailed) { 126 result.setStatus(Result.FAILED); 127 } else if(notApp) { 128 result.setStatus(Result.NOT_APPLICABLE); 129 }else { 130 result.setStatus(Result.PASSED); 131 } 132 133 134 return result; 135 } 136 137 boolean validateSchema(String schema){ 138 boolean valid=false; 139 if(schema !=null && !schema.trim().equals("")){ 140 valid =true; 141 } 142 return valid; 143 } 144 } 145 146 | Popular Tags |