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 45 46 public class WSXMLLocCheck extends WSTest implements WSCheck { 47 48 private String ejbWSXmlLoc = "META-INF/webservices.xml"; 50 private String jaxrpcWSXmlLoc = "WEB-INF/webservices.xml"; 51 52 56 public Result check (WebServiceEndpoint descriptor) { 57 58 Result result = getInitializedResult(); 59 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 60 61 63 InputStream deploymentEntry=null; 67 68 try { 69 String uri = getAbstractArchiveUri(descriptor); 71 FileArchive arch = new FileArchive(); 73 arch.open(uri); 74 if (descriptor.implementedByEjbComponent()) { 75 deploymentEntry = arch.getEntry(ejbWSXmlLoc); 76 } 77 else if (descriptor.implementedByWebComponent()) { 78 deploymentEntry = arch.getEntry(jaxrpcWSXmlLoc); 79 } 80 else { 81 throw new Exception ("Niether implemented by EJB nor by WEB Component"); 82 } 83 if (deploymentEntry != null) { 101 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 104 "For [ {0} ]", new Object [] {compName.toString()})); 105 result.passed(smh.getLocalString (getClass().getName() + ".passed", 106 "The webservices.xml file for [{0}] is located at the correct place.", 107 new Object [] {compName.toString()})); 108 109 } 110 else { 111 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 114 "For [ {0} ]", new Object [] {compName.toString()})); 115 result.failed(smh.getLocalString (getClass().getName() + ".failed", 116 "The webservices.xml file for [{0}] is not located in WEB-INF/META-INF directory as applicable.", 117 new Object [] {compName.toString()})); 118 119 } 121 }catch (Exception e) { 122 result.addErrorDetails(smh.getLocalString 124 ("com.sun.enterprise.tools.verifier.tests.webservices.Error", 125 "Error: Unexpected error occurred [ {0} ]", 126 new Object [] {e.getMessage()})); 127 } 129 finally { 130 131 try { 132 if (deploymentEntry != null) 133 deploymentEntry.close(); 134 }catch (IOException e) {} 135 } 136 137 return result; 138 } 139 } 140 141 | Popular Tags |