private String tableElementToString(Element tableElement) { StringBuilder result = new StringBuilder(); result.append("["); rowsToString(tableElement, result); result.append("]"); return result.toString(); }
private void colsToString(StringBuilder result, Element rowElement) { NodeList cols = rowElement.getElementsByTagName("col"); for (int col = 0; col < cols.getLength(); col++) { Element colElement = (Element) cols.item(col); result.append(colElement.getFirstChild().getNodeValue()); result.append(","); } result.deleteCharAt(result.length() - 1); }
private void rowsToString(Element tableElement, StringBuilder result) { NodeList rows = tableElement.getElementsByTagName("row"); for (int row = 0; row < rows.getLength(); row++) { result.append("["); Element rowElement = (Element) rows.item(row); colsToString(result, rowElement); result.append("],"); } result.deleteCharAt(result.length() - 1); }
@Test public void testBigContent() throws Exception { StringBuilder buffer = new StringBuilder(); for (int i = 0; i < 1000; i++) buffer.append("abcdefghijklmnopqrstuvwxyz"); WikiPageUtil.addPage(root, PathParser.parse("BigPage"), buffer.toString()); String content = root.getChildPage("BigPage").getData().getContent(); assertTrue(buffer.toString().equals(content)); }
private String convertToWikiText(Collection<GitVersionInfo> history) { final SimpleDateFormat dateFormat = new SimpleDateFormat(FitNesseContext.recentChangesDateFormat); StringBuilder builder = new StringBuilder(1024); for (GitVersionInfo versionInfo : history) { builder .append("|") .append(versionInfo.getComment()) .append("|") .append(versionInfo.getAuthor()) .append("|") .append(dateFormat.format(versionInfo.getCreationTime())) .append("|\n"); } return builder.toString(); }