Example #1
0
  public void testOrphansAreRemoved() throws Exception {
    performImportWithExtraLocalPages();

    assertFalse(localRoot.hasChildPage("PageThree"));
    assertFalse(pageOne.hasChildPage("ChildTwo"));
    assertFalse(childPageOne.hasChildPage("GrandChildOne"));

    assertTrue(localRoot.hasChildPage("PageThatDoesntImport"));
    assertTrue(localRoot.hasChildPage("OtherImportRoot"));
  }
Example #2
0
  public void testWholeTreeOrphaned() throws Exception {
    importer.importWiki(localRoot);

    remoteRoot.removeChildPage("PageOne");

    importer.importWiki(localRoot);

    assertFalse(localRoot.hasChildPage("PageOne"));
  }
 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;
 }
 private boolean targetPageExists() throws Exception {
   return newParentPage.hasChildPage(getNewPageName());
 }