示例#1
0
 private void addCountsToResult(TestSummary testSummary, Element resultElement) {
   Element counts = testResultsDocument.createElement("counts");
   resultElement.appendChild(counts);
   XmlUtil.addTextNode(testResultsDocument, counts, "right", Integer.toString(testSummary.right));
   XmlUtil.addTextNode(testResultsDocument, counts, "wrong", Integer.toString(testSummary.wrong));
   XmlUtil.addTextNode(
       testResultsDocument, counts, "ignores", Integer.toString(testSummary.ignores));
   XmlUtil.addTextNode(
       testResultsDocument, counts, "exceptions", Integer.toString(testSummary.exceptions));
 }
示例#2
0
    public void addItem(RecentChangesPageEntry line) throws Exception {
      Map<String, String> itemProperties = line.getItemProperties();
      Element itemElement = document.createElement("item");
      makeNodes(itemElement, itemProperties);
      linkPrefixBuilder.buildLink(itemElement, itemProperties.get("path"));

      String description = makeDescription(itemProperties);
      XmlUtil.addTextNode(itemElement, "description", description);
      channelElement.appendChild(itemElement);
    }
示例#3
0
 protected void startHtml() throws Exception {
   if (response.isXmlFormat()) {
     testResultsDocument = XmlUtil.newDocument();
     testResultsElement = testResultsDocument.createElement("testResults");
     testResultsDocument.appendChild(testResultsElement);
     XmlUtil.addTextNode(testResultsDocument, testResultsElement, "rootPath", page.getName());
   } else {
     buildHtml();
     addToResponse(formatter.head());
   }
 }
示例#4
0
  protected void addTestResultsToXmlDocument(TestSummary testSummary, String pageName)
      throws Exception {
    Element resultElement = testResultsDocument.createElement("result");
    testResultsElement.appendChild(resultElement);
    addCountsToResult(testSummary, resultElement);

    XmlUtil.addCdataNode(testResultsDocument, resultElement, "content", outputBuffer.toString());
    outputBuffer = null;

    XmlUtil.addTextNode(testResultsDocument, resultElement, "relativePageName", pageName);
  }
示例#5
0
    private Document buildDocumentWithRssHeader() throws Exception {
      Document rssDocument = XmlUtil.newDocument();
      Element rssDocumentElement = rssDocument.createElement("rss");
      rssDocument.appendChild(rssDocumentElement);
      channelElement = rssDocument.createElement("channel");
      rssDocumentElement.setAttribute("version", "2.0");
      rssDocumentElement.appendChild(channelElement);
      XmlUtil.addTextNode(channelElement, "title", "FitNesse:");

      return rssDocument;
    }
示例#6
0
    public void buildLink(Element itemElement, String pageName) throws Exception {
      String prefix = getRssLinkPrefix();
      String link = prefix + pageName;

      XmlUtil.addTextNode(itemElement, "link", link);
    }
示例#7
0
 private static void makeNodes(Element itemElement, Map<String, String> itemProperties) {
   XmlUtil.addTextNode(itemElement, "title", itemProperties.get("path"));
   XmlUtil.addTextNode(itemElement, "author", itemProperties.get("author"));
   XmlUtil.addTextNode(itemElement, "pubDate", itemProperties.get("pubDate"));
 }