1 23 package com.sun.enterprise.tools.verifier.tests.wsclients; 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 43 public class MappingFileCheck extends WSClientTest implements WSClientCheck { 44 45 49 public Result check (ServiceReferenceDescriptor descriptor) { 50 51 Result result = getInitializedResult(); 52 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 53 54 if (descriptor.hasWsdlFile()) { 55 56 if(descriptor.hasMappingFile()) { 57 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 59 "For [ {0} ]", new Object [] {compName.toString()})); 60 result.passed(smh.getLocalString (getClass().getName() + ".passed1", 61 "Mapping file specified because WSDL file is also specified.")); 62 63 } 64 else { 65 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 67 "For [ {0} ]", new Object [] {compName.toString()})); 68 result.failed(smh.getLocalString (getClass().getName() + ".failed1", 69 "The webservice client [{0}] has a WSDL file specified but no Mapping File.", 70 new Object [] {compName.toString()})); 71 } 72 } 73 else { 74 if(descriptor.hasMappingFile()) { 75 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 77 "For [ {0} ]", new Object [] {compName.toString()})); 78 result.failed(smh.getLocalString (getClass().getName() + ".failed1", 79 "The webservice client [{0}] has a Mapping file specified but no WSDL File.", 80 new Object [] {compName.toString()})); 81 } 82 else { 83 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 85 "For [ {0} ]", new Object [] {compName.toString()})); 86 result.passed(smh.getLocalString (getClass().getName() + ".passed2", 87 "Mapping file found at location [{0}] in archive.", 88 new Object [] {descriptor.getMappingFileUri()})); 89 } 90 } 91 92 if (descriptor.hasMappingFile()) { 93 String mappingFile = descriptor.getMappingFileUri(); 95 96 InputStream deploymentEntry=null; 100 101 try { 102 103 String uri = getAbstractArchiveUri(descriptor); 105 FileArchive arch = new FileArchive(); 107 arch.open(uri); 108 deploymentEntry = arch.getEntry(mappingFile); 109 if (deploymentEntry == null) { 119 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 121 "For [ {0} ]", new Object [] {compName.toString()})); 122 result.failed(smh.getLocalString (getClass().getName() + ".failed", 123 "The mapping file does not exist at the specified location [{0}] in the archive.", 124 new Object [] {mappingFile})); 125 } 126 else { 127 128 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 129 "For [ {0} ]", new Object [] {compName.toString()})); 130 result.passed(smh.getLocalString (getClass().getName() + ".passed", 131 "Mapping file found at location [{0}] in archive.", 132 new Object [] {mappingFile})); 133 } 134 }catch (Exception e) { 135 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 137 "For [ {0} ]", new Object [] {compName.toString()})); 138 result.failed(smh.getLocalString (getClass().getName() + ".failed", 139 "The mapping file does not exist at the specified location [{0}] in the archive.", 140 new Object [] {mappingFile})); 141 142 } 143 finally { 144 try { 145 if (deploymentEntry != null) 146 deploymentEntry.close(); 147 }catch(IOException e) {} 148 } 149 } 150 else { 151 result.addNaDetails(smh.getLocalString 153 ("tests.componentNameConstructor", "For [ {0} ]", 154 new Object [] {compName.toString()})); 155 result.notApplicable(smh.getLocalString 156 ( getClass().getName() + ".notapp", 157 "This webservice client does not have a Mapping File.")); 158 } 159 160 return result; 161 } 162 } 163 164 | Popular Tags |