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

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


              }
              catch (Exception e) {}
              // If the message is not an XML infoset, the assertion failed
              if (doc == null)
              {
                throw new AssertionFailException("The bound message part of the "
                  + "MIME part number " + (i + 1) + " is invalid XML infoset.");
              }
              // Creating a QName object of the root element
              QName rootName = new QName(
                doc.getDocumentElement().getNamespaceURI(),
                doc.getDocumentElement().getLocalName());
              // If the names of the root element and the referenced element
              // are not equal, the assertion failed
              if (!refName.equals(rootName))
              {
                throw new AssertionFailException("The root element name is "
                  + rootName + ", the name of the referenced element is "
                  + refName + ".");
              }
            }
          }
View Full Code Here


          // If there is a mime:part element containing a name attribute,
          // the assertion failed
          if (containsInvalidMimePart(inputMultiparts))
          {
            throw new AssertionFailException("The invalid "
                + "mime:part element is in the wsdl:input of the \""
                + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
                + "\" binding operation.");
          }
        }

        // If the wsdl:output contains mime:multipartRelated elements
        if (!outputMultiparts.isEmpty())
        {
          multipartsFound = true;

          // If there is a mime:part element containing a name attribute,
          // the assertion failed
          if (containsInvalidMimePart(outputMultiparts))
          {
            throw new AssertionFailException("The invalid "
                + "mime:part element is in the wsdl:output of the \""
                + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
                + "\" binding operation.");
          }
        }
View Full Code Here

      {
        String partName = (String) i.next();
        // If there is not exactly one accessor for the part specified,
        // the assertion failed
        if (getPartsCount(accessors, partName) != 1)
          throw new AssertionFailException(
            "The name of wsdl:part is " + partName);
      }
    }
    catch (AssertionNotApplicableException anae)
    {
View Full Code Here

            if (nextElem
              .getAttributeNodeNS(WSIConstants.NS_URI_SOAP, "encodingStyle")
              != null)
            {
              // Assertion failed
              throw new AssertionFailException(
                entryContext.getMessageEntry().getMessage());
            }
          }
        }
        catch (AssertionFailException e)
View Full Code Here

            String unboundPart = getUnboundPart(swaRefParts,
              portTypeInput.getMessage().getQName(),
              bindingInput == null ? null : bindingInput.getExtensibilityElements());
            // If such wsdl:part exists, assertion failed
            if (unboundPart != null)
              throw new AssertionFailException("The part \"" + unboundPart
                + "\" is not bound properly to the wsdl:input of the \""
                + bindingOperation.getName() + "\" binding operation.");
          }
        }

        // If the corresponding wsdl:output exists in wsdl:portType
        // and includes the message attribute
        if (portTypeOutput != null && portTypeOutput.getMessage() != null)
        {
          // Collecting all the message's parts defined with ref:swaRef
          List swaRefParts = getSwaRefParts(portTypeOutput.getMessage());
          if (!swaRefParts.isEmpty())
          {
            swaRefFound = true;
            // Getting a wsdl:part that is unbound
            String unboundPart = getUnboundPart(swaRefParts,
              portTypeOutput.getMessage().getQName(),
              bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
            // If such wsdl:part exists, assertion failed
            if (unboundPart != null)
              throw new AssertionFailException("The part \"" + unboundPart
                + "\" is not bound properly to the wsdl:input of the \""
                + bindingOperation.getName() + "\" binding operation.");
          }
        }
      }
View Full Code Here

          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();
      }
View Full Code Here

                || ((bom == WSIConstants.BOM_UTF16
                  && !charset.equalsIgnoreCase("utf-16")))
                || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN
                  && !charset.equalsIgnoreCase("utf-16"))))
              {
                throw new AssertionFailException("The BOM (" + bom +
                    ") and charset value (" + charset + ")do not match.");
              }
            }
            // (2) it has an XML declaration which matches the charset value in the Content-Type header, or
            else if (((xmlEncoding =
              Utils.getXMLEncoding(part.getContent())) != null) &&
              !xmlEncoding.equals("")) 
            {
              if(!xmlEncoding.equalsIgnoreCase(charset))
              {
                throw new AssertionFailException("The XML declaration encoding (" +
                    xmlEncoding + ") and charset value (" + charset +
                    ") do not match.");
              }
           
            }
            // (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8.
            else if(!charset.equalsIgnoreCase("utf-8"))
            {
              throw new AssertionFailException("The no BOM attribute and no XML "+
                  "declaration, and the charset value is (" + charset + ")");
            }
          }
          // header do not found or incorrect charset value
          else
          {
            throw new AssertionFailException("Either the Content-Type header is not "+
                "present in the Root Part or a charset value is invalid.");
          }
        }
        catch (AssertionFailException e)
        {
View Full Code Here

      // if the parts attribute is an empty string and there is
      // at least one accessor, the assertion failed
      if (parts != null && parts.isEmpty()
        && !XMLUtils.getChildElements(messageElement).isEmpty())
        throw new AssertionFailException("wsdl:operation name is "
          + potentialDocLitOps[0].getName());

    }
    catch (AssertionNotApplicableException anae)
    {
View Full Code Here

      {
        String partName = getMIMEContentPart((MIMEPart) parts.get(i));
        // find the corresponding MIME part
        if (findMIMEPart(mimeParts.getParts(), partName) == null)
        {           
          throw new AssertionFailException("The corresponding binding " +
              "operation \"" + bindingOperation.getName() +
              "\" does not contain part \"" + partName + "\"");
        }
      }
    }
View Full Code Here

        }
        // if part names match, validate format
        if((enPartName != null) && enPartName.equals(partName))
        {
          if((uid == null) || (uid.length() == 0))
            throw new AssertionFailException(
                "The \"Content-ID\" attribute of the part \""+(i+1)+
                "\"contains value \""+ m_partName+
                "\" which has a incorrect UID format");
          if(host == null)
            throw new AssertionFailException(
                "The \"Content-ID\" attribute of the part \""+(i+1)+
                "\"contains value \""+ m_partName+
                "\" which has a incorrect host format");
          // check for malformed URL
          try
          {
            new URL("HTTP", host, "");
          }
          catch (MalformedURLException e)
          {
            throw new AssertionFailException(
                "The \"Content-ID\" attribute of the part \""+(i+1)+
                "\"contains value \""+ m_partName+
                "\" which has a incorrect host format");
          }
          return m_partName;
View Full Code Here

TOP

Related Classes of org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException

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.