Package com.eviware.soapui.model.testsuite

Examples of com.eviware.soapui.model.testsuite.AssertionError


    protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext context)
            throws AssertionException {
        Vector<?> result = ((WsdlMessageExchange) messageExchange).getResponseWssResult();

        if (result == null || result.isEmpty()) {
            throw new AssertionException(new AssertionError("Missing WS-Security results"));
        }

        for (int c = 0; c < result.size(); c++) {
            if (result.get(c) instanceof Exception) {
                throw new AssertionException(new AssertionError("WS-Security validation failed: " + result.get(c)));
            }
        }

        return "WS-Security status OK";
    }
View Full Code Here


        try {
            SoapVersion soapVersion = ((WsdlMessageExchange) messageExchange).getOperation().getInterface()
                    .getSoapVersion();

            if (!SoapUtils.isSoapFault(responseContent, soapVersion)) {
                throw new AssertionException(new AssertionError("Response is not a SOAP Fault"));
            }
        } catch (Exception e) {
            throw new AssertionException(new AssertionError(e.getMessage()));
        }

        return "Response is a SOAP Fault";
    }
View Full Code Here

                throw new AssertionException(errors);
            }
        } catch (AssertionException e) {
            throw e;
        } catch (Exception e) {
            throw new AssertionException(new AssertionError(e.getMessage()));
        }

        return "Response Envelope OK";
    }
View Full Code Here

        protected ValidationError[] validateXml(String xml) {
            WsdlOperation operation = getModelItem().getMockOperation().getOperation();

            if (operation == null) {
                return new ValidationError[]{new AssertionError("Missing operation for MockResponse")};
            }

            WsdlValidator validator = new WsdlValidator((operation.getInterface()).getWsdlContext());
            WsdlMockResultMessageExchange messageExchange =
                    new WsdlMockResultMessageExchange((WsdlMockResult) getModelItem().getMockResult(), getModelItem());
View Full Code Here

        }

        protected ValidationError[] validateXml(String xml) {
            WsdlOperation operation = getModelItem().getMockOperation().getOperation();
            if (operation == null) {
                return new ValidationError[]{new AssertionError("Missing operation for MockResponse")};
            }

            WsdlValidator validator = new WsdlValidator((operation.getInterface()).getWsdlContext());
            return validator.assertResponse(new WsdlMockResponseMessageExchange(getModelItem()), false);
        }
View Full Code Here

      if (partialValidation) {
        if (StringUtils.hasContent(rootElementXPath)) {
          SoapUI.log.debug("Root XPath is: " + rootElementXPath);
          nodes = xmlHolder.getDomNodes(rootElementXPath);
        } else {
          AssertionError error = new AssertionError("XPath for validation root element is missing");
          throw new AssertionException(error);
        }
      } else {
        XmlObject xmlObject = xmlHolder.getXmlObject();
        nodes = new Node[1];
        nodes[0] = xmlObject.getDomNode();
      }
    } catch (XmlException e) {
      AssertionError error = new AssertionError(e.getError());
      throw new AssertionException(error);
    }
   
    if (nodes.length == 0) {
      AssertionError error = new AssertionError("XPath '" + rootElementXPath + "' returned no nodes");
      throw new AssertionException(error);
    }
    return nodes;
  }
View Full Code Here

    try {
      for (int i = 0; i < definitionPaths.length; ++i) {
        fileSources[i] = new StreamSource(buildAbsoluteFilepath(context, definitionPaths[i]));
      }
    } catch (FileNotFoundException e) {
      AssertionError error = new AssertionError(e.getLocalizedMessage());
      throw new AssertionException(error);
    }
   
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Validator validator = null;
    try {
      Schema schema = schemaFactory.newSchema(fileSources);
      validator = schema.newValidator();
    }
    catch (SAXException e) {
      AssertionError error = new AssertionError("Could not process XML schema at " + fileSources + ": " + e.getLocalizedMessage());
      throw new AssertionException(error);
    }
    return validator;
  }
View Full Code Here

      StringReader reader = new StringReader(xmlToValidate);
      Source source = new SAXSource(new InputSource(reader));
      try {
        validator.validate(source);
      } catch (SAXException e) {
        AssertionError error = new AssertionError("Schema validation failed: " + e.getLocalizedMessage());
        throw new AssertionException(error);
      } catch (IOException e) {
        AssertionError error = new AssertionError("Schema validation failed: " + e.getLocalizedMessage());
        throw new AssertionException(error);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.testsuite.AssertionError

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.