Пример #1
0
  public Element addExecutorXml(Element targetScenario, Document doc) {
    Element ifElement = doc.createElement(getXmlTag());
    appendAdditionalData(ifElement);

    Element scriptCondition = getScriptConditionElement(doc);

    ifElement.appendChild(scriptCondition);

    if (!(this instanceof AntIfElseIf)) {
      Element echo1 = doc.createElement("echo");
      echo1.setAttribute("message", "Check condition " + test.getConditionString());
      targetScenario.appendChild(echo1);
    }

    /*
     * Create and add the sequential tag and content
     */
    Element then = doc.createElement(XML_CONTAINER_TAG);

    // go over all tests append a target that invokes them
    // to the ant script and add an antcall to the test in the execute scenario target
    ifElement.appendChild(then);
    for (JTest jtest : rootTests) {
      // Add echos for AntIfElseIf...
      if (jtest instanceof AntIfElseIf) {
        AntIfElseIf elseIf = (AntIfElseIf) jtest;
        Element elseIf1 = doc.createElement("echo");
        elseIf1.setAttribute("message", "Else if " + elseIf.getIfTest().getConditionString());
        targetScenario.appendChild(elseIf1);
      }
      if ((jtest instanceof AntIfElseIf) || (jtest instanceof AntIfElse)) {
        jtest.addExecutorXml(ifElement, doc);
      } else {
        jtest.addExecutorXml(then, doc);
      }
    }

    targetScenario.appendChild(ifElement);

    return ifElement;
  }