@Test
 public void testFirstRecentChange() throws Exception {
   assertEquals(false, rootPage.hasChildPage("RecentChanges"));
   recentChangesWikiPage.updateRecentChanges(newPage);
   assertEquals(true, rootPage.hasChildPage("RecentChanges"));
   WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
   List<String> lines = recentChangesWikiPage.getRecentChangesLines(recentChanges.getData());
   assertEquals(1, lines.size());
   assertHasRegexp("SomeNewPage", lines.get(0));
 }
Ejemplo n.º 2
0
  public void testRecursiveAddbyName() throws Exception {
    crawler.addPage(root, PathParser.parse("AaAa"), "its content");
    assertTrue(root.hasChildPage("AaAa"));

    crawler.addPage(root, PathParser.parse("AaAa.BbBb"), "floop");
    assertTrue(crawler.pageExists(root, PathParser.parse("AaAa.BbBb")));
    assertEquals(
        "floop", crawler.getPage(root, PathParser.parse("AaAa.BbBb")).getData().getContent());
  }
Ejemplo n.º 3
0
 private boolean isValidWikiPageName(String linkName, WikiPageProperty symLinks) throws Exception {
   if (page.hasChildPage(linkName) && !symLinks.has(linkName)) {
     response =
         new ErrorResponder(resource + " already has a child named " + linkName + ".")
             .makeResponse(context, null);
     response.setStatus(412);
     return false;
   } else if (!PathParser.isSingleWikiWord(linkName)) {
     response =
         new ErrorResponder(linkName + " is not a valid WikiWord.").makeResponse(context, null);
     response.setStatus(412);
     return false;
   }
   return true;
 }
Ejemplo n.º 4
0
 public boolean hasChildPage(String name) throws Exception {
   return realPage.hasChildPage(name);
 }