1 23 package com.sun.enterprise.tools.verifier.tests.webservices; 24 25 import com.sun.enterprise.deployment.*; 26 import com.sun.enterprise.deployment.deploy.shared.FileArchive; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 import java.io.*; 30 31 34 35 47 public class MappingFileCheck extends WSTest implements WSCheck { 48 49 53 public Result check (WebServiceEndpoint descriptor) { 54 55 Result result = getInitializedResult(); 56 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 57 String mappingFile = descriptor.getWebService().getMappingFileUri(); 58 if (getVerifierContext().getSchemaVersion().compareTo("1.1") > 0) { 59 if (mappingFile != null) { 60 addWarningDetails(result, compName); 61 result.warning(smh.getLocalString (getClass().getName() + ".warning", 62 "The mapping file as specified in location [ {0} ] is not required.", 63 new Object [] {mappingFile})); 64 return result; 65 } 66 } else { 67 InputStream deploymentEntry=null; 68 try { 69 String uri = getAbstractArchiveUri(descriptor); 70 try { 71 FileArchive arch = new FileArchive(); 72 arch.open(uri); 73 deploymentEntry = arch.getEntry(mappingFile); 74 }catch (IOException e) { throw e;} 75 if (deploymentEntry == null) { 76 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 78 "For [ {0} ]", new Object [] {compName.toString()})); 79 result.failed(smh.getLocalString (getClass().getName() + ".failed", 80 "The mapping file does not exist at the specified location [{0}] in the archive.", 81 new Object [] {mappingFile})); 82 83 } 84 }catch (Exception e) { 85 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 86 "For [ {0} ]", new Object [] {compName.toString()})); 87 result.failed(smh.getLocalString (getClass().getName() + ".failed", 88 "The mapping file does not exist at the specified location [{0}] in the archive.", 89 new Object [] {mappingFile})); 90 } 91 finally { 92 try { 93 if (deploymentEntry != null) 94 deploymentEntry.close(); 95 }catch(IOException e) {} 96 } 97 } 98 if(result.getStatus() != Result.FAILED || result.getStatus() != Result.WARNING) { 99 addGoodDetails(result, compName); 100 result.passed(smh.getLocalString (getClass().getName() + ".passed", 101 "mapping file requirements are satisfied")); 102 } 103 return result; 104 } 105 } 106 | Popular Tags |