FileDocCategorySizeDatePackage
WSDLFileCheck.javaAPI DocGlassfish v2 API5791Fri May 04 22:34:16 BST 2007com.sun.enterprise.tools.verifier.tests.webservices

WSDLFileCheck

public class WSDLFileCheck extends WSTest implements WSCheck

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebServiceEndpoint descriptor)

param
descriptor the WebServices descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

//        boolean pass = true;

//        File f = Verifier.getArchiveFile(descriptor.getBundleDescriptor().
//                 getModuleDescriptor().getArchiveUri());
//        JarFile jarFile = null;
        InputStream deploymentEntry=null;

        // wsdl file
        String wsdlUri = descriptor.getWebService().getWsdlFileUri(); 

        try {
//             if (f == null) {
              String uri = getAbstractArchiveUri(descriptor);
//              try {
                 FileArchive arch = new FileArchive();
                 arch.open(uri);
                 deploymentEntry = arch.getEntry(wsdlUri);
//              }catch (IOException e) { throw e;}
//             }
//             else {
//
//               jarFile = new JarFile(f);
//               ZipEntry deploymentEntry1 =
//                   jarFile.getEntry(wsdlUri);
//               deploymentEntry = jarFile.getInputStream(deploymentEntry1);
//            }
            if (deploymentEntry == null) {
               //result.fail, 
                result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
                result.failed(smh.getLocalString (getClass().getName() + ".failed",
                "WSDL file does not exist in the archive at uri [{0}].",
                new Object[] {wsdlUri}));

//               pass = false;
            }
            else {
               //result.pass
               result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
               result.passed(smh.getLocalString (getClass().getName() + ".passed", 
                          "WSDL file exists in the archive at uri [{0}].",
                           new Object[] {wsdlUri}));

            }
        }catch (Exception e) {
          // result.fail
          result.addErrorDetails(smh.getLocalString
               ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
                "Error: Unexpected error occurred [ {0} ]",
                new Object[] {e.getMessage()}));
//          pass = false;
        }
        finally {
           try {
           if (deploymentEntry != null)
               deploymentEntry.close();
           }catch(IOException e) {}
        }

        return result;