1 23 24 25 package com.sun.enterprise.tools.verifier.tests.persistence; 26 27 import com.sun.enterprise.deployment.Descriptor; 28 import com.sun.enterprise.deployment.PersistenceUnitDescriptor; 29 import com.sun.enterprise.tools.verifier.Result; 30 import com.sun.enterprise.tools.verifier.tests.VerifierCheck; 31 import com.sun.enterprise.tools.verifier.tests.VerifierTest; 32 import java.util.ArrayList ; 33 import java.util.List ; 34 35 41 public class MappingFileNotFound extends VerifierTest implements VerifierCheck { 42 43 public Result check(Descriptor descriptor) { 44 Result result = getInitializedResult(); 45 result.setStatus(Result.PASSED); 46 addErrorDetails(result, getVerifierContext().getComponentNameConstructor()); 47 48 PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(descriptor); 49 List <String > mappingFileNames = new ArrayList <String >(pu.getMappingFiles()); 50 for (String mappingFileName : mappingFileNames) { 51 if(getVerifierContext().getClassLoader().getResource(mappingFileName) == null) { 52 result.failed(smh.getLocalString( 53 getClass().getName() + "failed", 54 "Mapping file [ {0} ] specified in persistence.xml does not exist in the application.", 55 new Object []{mappingFileName})); 56 } 57 } 58 return result; 59 } 60 61 } 62 | Popular Tags |