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 import java.net.URL ; 31 32 35 36 45 46 public class WSDLFileCheck extends WSClientTest implements WSClientCheck { 47 48 52 public Result check (ServiceReferenceDescriptor descriptor) { 53 54 Result result = getInitializedResult(); 55 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 56 57 InputStream deploymentEntry=null; 58 59 if (descriptor.hasWsdlFile()) { 61 String wsdlUri = descriptor.getWsdlFileUri(); 62 URL url = null; 63 try { 64 url = new URL (wsdlUri); 65 } catch(java.net.MalformedURLException e) { 66 } 68 if (url != null) { 69 if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) { 70 return result; 71 } 72 } 73 try { 74 String uri = getAbstractArchiveUri(descriptor); 75 FileArchive arch = new FileArchive(); 76 arch.open(uri); 77 deploymentEntry = arch.getEntry(wsdlUri); 78 79 if (deploymentEntry == null) { 80 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 82 "For [ {0} ]", new Object [] {compName.toString()})); 83 result.failed(smh.getLocalString (getClass().getName() + ".failed", 84 "WSDL file does not exist in the archive at uri [{0}].", 85 new Object [] {wsdlUri})); 86 } 87 else { 88 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 90 "For [ {0} ]", new Object [] {compName.toString()})); 91 result.passed(smh.getLocalString (getClass().getName() + ".passed", 92 "WSDL file exists in the archive at uri [{0}].", 93 new Object [] {wsdlUri})); 94 95 } 96 }catch (Exception e) { 97 result.addErrorDetails(smh.getLocalString 99 ("com.sun.enterprise.tools.verifier.tests.webservices.Error", 100 "Error: Unexpected error occurred [ {0} ]", 101 new Object [] {e.getMessage()})); 102 } 103 finally { 104 try { 105 if (deploymentEntry != null) 106 deploymentEntry.close(); 107 }catch (IOException e) {} 108 } 109 110 } 111 else { 112 result.addNaDetails(smh.getLocalString 114 ("tests.componentNameConstructor", "For [ {0} ]", 115 new Object [] {compName.toString()})); 116 result.notApplicable(smh.getLocalString 117 ( getClass().getName() + ".notapp", 118 "Not applicable since Service Client does not have a WSDL file specified.")); 119 120 } 121 122 return result; 123 } 124 } 125 126 | Popular Tags |