Examples of AssertionPassException


Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

        }
        catch (Exception e)
        {
          throw new AssertionFailException(e.getMessage());
        }
        throw new AssertionPassException();
      }

      /* soap message is not doc-lit so try :
       * Rpc-lit
       */
 
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

        // to "http://schemas.xmlsoap.org/soap/actor/next",
        // then the assertion passed
        if (actor != null
          && !actor.getNodeValue().equals(WSIConstants.NS_URI_SOAP_NEXT_ACTOR))
        {
          throw new AssertionPassException();
        }
      }

      // No one actor attribute has a value other than
      // "http://schemas.xmlsoap.org/soap/actor/next",
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

      // Parse log message
      //gets first string
      int idx = entryContext.getMessageEntry().getMessage().indexOf("<?xml");
      if (idx == -1)
      {
        throw new AssertionPassException();
      }

      int idx2 = entryContext.getMessageEntry().getMessage().indexOf("?>");
      if (idx2 == -1)
      {
        throw new AssertionPassException();
      }

      String xmlDeclaration = entryContext.getMessageEntry().getMessage()
        .substring(idx, idx2 + "?>".length());

      idx = xmlDeclaration.indexOf("encoding");
      if (idx == -1)
      {
        if (charsetValue.equalsIgnoreCase("utf-8"))
        {
            throw new AssertionPassException();
        }
        else
        {
          throw new AssertionFailException("There is no XML declaration and the"
            + " charset value in the Content-Type header is not UTF-8."
            + "\nCharset value in the Content-Type header: " + charsetValue);
        }
      }

      int idxQ = xmlDeclaration.indexOf('\'', idx);
      int idxQQ = xmlDeclaration.indexOf('\"', idx);
      int idxQuote = -1;
      char qouteCh = '\0';
      if (idxQ == -1)
      {
        idxQuote = idxQQ;
        qouteCh = '\"';
      }
      else
      {
        if (idxQQ == -1)
        {
          idxQuote = idxQ;
          qouteCh = '\'';
        }
        else
        {
          if (idxQQ < idxQ)
          {
            idxQuote = idxQQ;
            qouteCh = '\"';
          }
          else
          {
            idxQuote = idxQ;
            qouteCh = '\'';
          }
        }
      }

      if (idxQuote == -1 || qouteCh == '\0')
      {
        throw new AssertionPassException();
      }

      int idxLQoute = xmlDeclaration.indexOf(qouteCh, idxQuote + 1);

      if (idxLQoute == -1)
      {
        throw new AssertionPassException();
      }

      String xmlEncoding =
        xmlDeclaration.substring(idxQuote + 1, idxLQoute);
      if (charsetValue.equalsIgnoreCase(xmlEncoding))
      {
        // If there is a BOM, then check that it is the same as the xmlEncoding
        int bom = 0;
        if ((bom = entryContext.getMessageEntry().getBOM()) != 0)
        {
          if ((bom == WSIConstants.BOM_UTF8
            && !xmlEncoding.equalsIgnoreCase("utf-8"))
            || ((bom == WSIConstants.BOM_UTF16
              && !xmlEncoding.equalsIgnoreCase("utf-16")))
            || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN
              && !xmlEncoding.equalsIgnoreCase("utf-16"))))
          {
            throw new AssertionFailException(
              "The BOM and XML declaration do not match.");
          }
        }

        throw new AssertionPassException();
      }
      else
      {
        throw new AssertionFailException("There is an XML declaration, but its "
          + "encoding value does not match the charset value.\n"
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

      //isSchemaValid = true; // for now, getting this far does it

      if (isSchemaValid)
      {
        throw new AssertionPassException();
      }
      else
      {
        throw new AssertionFailException();
      }
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

            }
          }
        }
      }

      throw new AssertionPassException();
      // no dotted notation used in a faultcode element
    }
    catch (AssertionPassException e)
    {
      result = AssertionResult.RESULT_PASSED;
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

          Node muNode = elems.item(i).getAttributes().getNamedItem(
            root.getPrefix() + ":" + XMLUtils.SOAP_ATTR_MUST_UNDERSTAND);
          // If a header block is mandatory, then the assertion passed
          if (muNode != null && muNode.getNodeValue().equals("1"))
          {
            throw new AssertionPassException();
          }
        }

        // Getting header block name
        String blockName = elems.item(i).getLocalName();
        // If the name is not presented (occurs when element is empty string)
        // then continue with the next element
        if (blockName == null)
        {
          continue;
        }

        boolean blockNameExists = false;

        // Getting WSDL bindings
        Binding[] bindings = validator.getWSDLDocument().getBindings();
        for (int j = 0; j < bindings.length; j++)
        {
          // Getting wsdl:operations
          List operations = bindings[j].getBindingOperations();
          Iterator k = operations.iterator();
          while (k.hasNext() && !blockNameExists)
          {
            BindingOperation operation = (BindingOperation) k.next();

            // If this is a request message,
            // then getting wsdl:input for an operation
            if (entryContext.getMessageEntry().getType().equals(
              MessageEntry.TYPE_REQUEST))
            {
              BindingInput opInput = operation.getBindingInput();
              if (opInput != null)
              {
                // If wsdl:input is presented then checking
                // whether the block name is described there or not
                blockNameExists = blockNameExists(
                  opInput.getExtensibilityElements(), blockName);
              }
            }
            // If this is a response message,
            // then getting wsdl:output for an operation
            else
            {
              BindingOutput opOutput = operation.getBindingOutput();
              if (opOutput != null)
              {
                // If wsdl:output is presented then checking
                // whether the block name is described there or not
                blockNameExists = blockNameExists(
                  opOutput.getExtensibilityElements(), blockName);
              }
            }
          }
        }

        // If a header block is not described in the appropriate wsdl:binding
        // then the assertion passed
        if (!blockNameExists)
        {
          throw new AssertionPassException();
        }
      }

      // No one header block is either mandatory or is not described in the
      // appropriate wsdl:binding, the assertion is not applicable
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

      Document doc =
        XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());

      if (this.validator.isFault(doc))
      {
        throw new AssertionPassException();
      }

      // Parse request message
      Document docRequest =
        XMLUtils.parseXML(entryContext.getRequest().getMessage());

      // get SOAPAction
      String headers = entryContext.getRequest().getHTTPHeaders();
      String action = null;
      if (headers != null)
        action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());

      Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
      TypesRegistry registry =
        new TypesRegistry(
          this.validator.getWSDLDocument().getDefinitions(),
          validator);
      OperationSignature.OperationMatch match =
        OperationSignature.matchOperation(
          docRequest,
          action,
          binding,
          registry);

      if (match == null)
        throw new AssertionPassException();

      BindingOperation bindingOperation = match.getOperation();

      Message operationMessage = null;
      if (MessageEntry
        .TYPE_REQUEST
        .equals(entryContext.getMessageEntry().getType())
        && (bindingOperation.getOperation().getInput() != null))
      {
        operationMessage =
          bindingOperation.getOperation().getInput().getMessage();
      }
      else
      {
        if (MessageEntry
          .TYPE_RESPONSE
          .equals(entryContext.getMessageEntry().getType())
          && (bindingOperation.getOperation().getOutput() != null))
        {
          operationMessage =
            bindingOperation.getOperation().getOutput().getMessage();
        }
      }

      if (operationMessage == null)
        throw new AssertionPassException();

      boolean isContainArray = false;

      Collection parts = operationMessage.getParts().values();
      for (Iterator iter = parts.iterator(); iter.hasNext();)
      {
        Part part = (Part) iter.next();

        QName type = null;

        if (part.getTypeName() == null)
        {
          type = registry.getType(part.getElementName());
        }
        else
        {
          type = part.getTypeName();
        }

        isContainArray =
          registry.isExtendsArray(type)
            || registry.isUsesWSDLArrayType(type)
            || isArrayType(type);
        if (isContainArray)
          break;
      }

      if (isContainArray)
      {
        // Gets body
        NodeList soapBodyList =
          doc.getElementsByTagNameNS(
            WSIConstants.NS_URI_SOAP,
            XMLUtils.SOAP_ELEM_BODY);
        if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
        {
          throw new AssertionFailException();
        }

        Element soapBodyElem = (Element) soapBodyList.item(0);

        NodeList soapBodyCildrenList =
          soapBodyElem.getElementsByTagNameNS("*", "*");
        for (int indexChild = 0;
          indexChild < soapBodyCildrenList.getLength();
          indexChild++)
        {
          Element elem = (Element) soapBodyCildrenList.item(indexChild);
          if (elem
            .hasAttributeNS(
              WSIConstants.NS_URI_SOAP_ENCODING,
              WSIConstants.ATTR_ARRAY_TYPE))
          {
            throw new AssertionFailException();
          }
        }

        throw new AssertionPassException();
      }
      else
      {
        throw new AssertionPassException();
      }

    }
    catch (AssertionNotApplicableException e)
    {
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

          }

          if (isOneWayResponse)
          {
            if (operation.getOutput() == null)
              throw new AssertionPassException();
            else
              throw new AssertionFailException();
          }

          //    check whether the response message from the log
          //  contains the output message
          NodeList soapBodyList =
            docResponse.getElementsByTagNameNS(
              WSIConstants.NS_URI_SOAP,
              XMLUtils.SOAP_ELEM_BODY);
          if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
          {
            // Response does not contain any soap Body elements
            throw new AssertionFailException();
          }
          for (int i = 0; i < soapBodyList.getLength(); i++)
          {
            Element nextBodyElem = (Element) soapBodyList.item(i);
            Element soapMessageElement = XMLUtils.getFirstChild(nextBodyElem);
            while (soapMessageElement != null)
            {
              // check whether the operation output has message from SOAP response
              Message message = operation.getOutput().getMessage();
              QName soapMessageQName =
                new QName(
                  soapMessageElement.getNamespaceURI(),
                  soapMessageElement.getLocalName());

              if (message != null
                && soapMessageQName.equals(message.getQName()))
              {
                throw new AssertionPassException();
              }

              soapMessageElement =
                XMLUtils.getNextSibling(soapMessageElement);
            }
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

        for (int i = 0; i < attrs.getLength(); i++)
        {
          String attrName = ((Attr) attrs.item(i)).getName();
          if (!attrName.equals("xmlns") && !attrName.startsWith("xmlns:"))
          {
            throw new AssertionPassException();
          }
        }
      }

      throw new AssertionNotApplicableException();
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException

        for (int i = 0; i < list.getLength(); i++)
        {
          if((list.item(i).getNodeType() == Node.ELEMENT_NODE)
          && (list.item(i).getLocalName() != null) )
          {
            throw new AssertionPassException();
          }
        }
      }

      // There is no detail element in Fault,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.