Package org.eclipse.wst.wsi.internal.analyzer

Examples of org.eclipse.wst.wsi.internal.analyzer.WSDLAnalyzer


      Collection services = definition.getServices().values();
      Collection bindings = definition.getBindings().values();
      Collection portTypes = definition.getPortTypes().values();
      Collection messages = definition.getMessages().values();

      WSDLAnalyzer wsdlAnalyzer;
    if(withAttachments)
    {
      WSIPreferences preferences = new WSIPreferences();
         preferences.setComplianceLevel(wsiLevel);
      preferences.setTADFile(WSITestToolsProperties.AP_ASSERTION_FILE);
      wsdlAnalyzer = new WSDLAnalyzer(uri, preferences);
    }
    else if(withBasic)
    {
      WSIPreferences preferences = new WSIPreferences();
    preferences.setComplianceLevel(wsiLevel)
      preferences.setTADFile(WSITestToolsProperties.SSBP_ASSERTION_FILE);
      wsdlAnalyzer = new WSDLAnalyzer(uri, preferences);
    }
    else if(wsiPreference != null)
    {
    wsdlAnalyzer = new WSDLAnalyzer(uri, wsiPreference);
    }
    else {
    // default preference setting
      wsdlAnalyzer = new WSDLAnalyzer(uri);
    }

    // The WS-I conformance tools require that each service be analyzed separately.
    // Get all the services and analyze them.
    if (services != null && !services.isEmpty())
    {
      Iterator serviceIterator = services.iterator();

      while (serviceIterator.hasNext())
        {
          Service service = (Service) serviceIterator.next();

          String servicename = service.getQName().getLocalPart();

          Collection ports = service.getPorts().values();
          if (ports != null && !ports.isEmpty())
          {
            // The WS-I tools must be called once for each port within each service.
            Iterator portIterator = ports.iterator();
            while (portIterator.hasNext())
            {
              Port port = (Port) portIterator.next();

              try
              {
                wsdlAnalyzer.addConfigurationToTest(servicename, namespace, port.getName(), WSDLAnalyzer.PORT);
        hasAnalyzerConfig = true;
              }
              catch (WSIAnalyzerException e)
              {
                // TODO: Add code to log error
                //System.out.println("exception " + e);
              }

            }
          }
        }
      }
      // validate at the binding level - check for every binding
      else if (bindings != null && !bindings.isEmpty())
      {
        Iterator bindingIterator = bindings.iterator();

        while (bindingIterator.hasNext())
        {
          Binding binding = (Binding) bindingIterator.next();

          String bindingname = binding.getQName().getLocalPart();
          try
          {
            wsdlAnalyzer.addConfigurationToTest(null, namespace, bindingname, WSDLAnalyzer.BINDING);
      hasAnalyzerConfig = true;
          }
          catch (WSIAnalyzerException e)
          {
            // TODO: Add code to log error
            //System.out.println("exception " + e);
          }
        }
      }
      // validate at the portType level - check for every portType
      else if (portTypes != null && !portTypes.isEmpty())
      {
        Iterator portTypeIterator = portTypes.iterator();
        while (portTypeIterator.hasNext())
        {
          PortType portType = (PortType) portTypeIterator.next();
          String portTypename = portType.getQName().getLocalPart();
          try
          {
            wsdlAnalyzer.addConfigurationToTest(null, namespace, portTypename, WSDLAnalyzer.PORTTYPE);
      hasAnalyzerConfig = true;
          }
          catch (WSIAnalyzerException e)
          {
            // TODO: Add code to log error
            //System.out.println("exception " + e);
          }
        }
      }
      // validate at the message level - check for every message
      else if (messages != null && !messages.isEmpty())
      {
        Iterator messageIterator = messages.iterator();

        while (messageIterator.hasNext())
        {
          Message message = (Message) messageIterator.next();
          String messagename = message.getQName().getLocalPart();
          try
          {
            wsdlAnalyzer.addConfigurationToTest(null, namespace, messagename, WSDLAnalyzer.MESSAGE);
      hasAnalyzerConfig = true;
          }
          catch (WSIAnalyzerException e)
          {
            // TODO: Add code to log error
            //System.out.println("exception " + e);
          }
        }
      }
      try
      {
        // only run the analyzer if there is something to check
    if(hasAnalyzerConfig)
    {
      // run the conformance check and add errors and warnings as needed
      wsdlAnalyzer.validateConformance();
       
      // If the level is suggest all errors should be reported as warnings.
      if(wsdlAnalyzer.getWSIPreferences().getComplianceLevel().equals(WSITestToolsProperties.WARN_NON_WSI))
      {
        addWarnings(wsdlAnalyzer.getAssertionErrors(), valInfo);
      }
      else
      {
        addErrors(wsdlAnalyzer.getAssertionErrors(), valInfo);
      }
      addWarnings(wsdlAnalyzer.getAssertionWarnings(), valInfo);
    }
      }
    catch (WSIAnalyzerException e)
    {
    // TODO: Add code to log error
View Full Code Here

TOP

Related Classes of org.eclipse.wst.wsi.internal.analyzer.WSDLAnalyzer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.