Пример #1
0
  private void checkSimpleContent() throws Exception {
    if (this.extension == null) {
      XMLTestCase.fail("Extension base name is not set.");
    }

    // This will always pass as the NDR validation isn't coded yet.
    XMLTestCase.assertTrue(true);
  }
Пример #2
0
  /**
   * Check the Complex Items.
   *
   * @throws Exception
   */
  private void checkComplex() throws Exception {
    XPathComponentHelper xpathHelper = new XPathComponentHelper();

    if (this.extension == null) {
      XMLTestCase.fail("Extension base name is not set.");
    }

    String xpath = xpathHelper.xpathComponentName(this.componentName);
    XMLAssert.assertXpathExists(xpath, this.getXsdSourceDocument());

    xpath = xpathHelper.xpathCompExtenBase(this.componentName, this.extension);
    XMLAssert.assertXpathExists(xpath, this.getXsdSourceDocument());

    if (this.sequenceFields.isEmpty() == true && this.choiceSequenceFields.isEmpty() == true) {
      XMLTestCase.assertTrue(true);
    } else {

      // Check all the fields.
      for (Iterator fields = sequenceFields.iterator(); fields.hasNext(); ) {
        ComponentField seqField = (ComponentField) fields.next();
        xpath =
            xpathHelper.xpathCompExtElements(
                this.componentName, this.extension, seqField.getFieldName());
        XMLAssert.assertXpathExists(xpath, this.getXsdSourceDocument());

        // xpath = xpathHelper.xpathCompExtElementDoc(this.componentName, this.extension,
        // seqField.getFieldName());
        // xmlTest.assertXpathExists(xpath, this.getXsdSourceDocument());

        if (seqField.getMinOccurs() != null) {
          if (seqField.getMinOccurs().equalsIgnoreCase("0")) {
            xpath =
                xpathHelper.xpathCompExtElementOptional(
                    this.componentName, this.extension, seqField.getFieldName());
          } else {
            xpath =
                xpathHelper.xpathCompExtElementMinOccurs(
                    this.componentName,
                    this.extension,
                    seqField.getFieldName(),
                    seqField.getMinOccurs());
          }
          XMLAssert.assertXpathExists(xpath, this.getXsdSourceDocument());
        }

        if (seqField.getMaxOccurs() != null) {
          xpath =
              xpathHelper.xpathCompExtElementMaxOccurs(
                  this.componentName,
                  this.extension,
                  seqField.getFieldName(),
                  seqField.getMaxOccurs());
          XMLAssert.assertXpathExists(xpath, this.getXsdSourceDocument());
        }
      }
    }
  }