public void testSymbolicLinkListing() throws Exception {
    WikiPage page = root.addChildPage("SomePage");
    page.addChildPage("SomeChild");
    WikiPage pageOne = root.addChildPage("PageOne"); // ...page must exist!
    pageOne.addChildPage("ChildOne"); // ...page must exist!

    PageData data = page.getData();
    WikiPageProperties props = data.getProperties();
    WikiPageProperty symProp = props.set(SymbolicPage.PROPERTY_NAME);
    symProp.set("InternalAbsPage", ".PageOne.ChildOne");
    symProp.set("InternalRelPage", "PageOne.ChildOne");
    symProp.set("InternalSubPage", ">SomeChild");
    symProp.set("ExternalPage", "file://some/page");
    page.commit(data);

    getPropertiesContentFromPage(page);

    assertSubString("<td>InternalAbsPage</td>", content);
    assertSubString("<input type=\"text\" name=\"InternalAbsPage\"", content);
    assertSubString("<a href=\".PageOne.ChildOne\">.PageOne.ChildOne</a>", content);
    assertMatches("<a href=\".*\">&nbsp;Rename:</a>", content);

    assertSubString("<td>InternalRelPage</td>", content);
    assertSubString("<input type=\"text\" name=\"InternalRelPage\"", content);
    assertSubString("<a href=\".PageOne.ChildOne\">PageOne.ChildOne</a>", content);

    assertSubString("<td>InternalSubPage</td>", content);
    assertSubString("<input type=\"text\" name=\"InternalSubPage\"", content);
    assertSubString("<a href=\".SomePage.SomeChild\">&gt;SomeChild</a>", content);

    assertSubString("<td>file://some/page</td>", content);
  }
 @Before
 public void setUp() throws Exception {
   rootPage = InMemoryPage.makeRoot("RooT");
   newPage = rootPage.addChildPage("SomeNewPage");
   page1 = rootPage.addChildPage("PageOne");
   page2 = rootPage.addChildPage("PageTwo");
   recentChangesWikiPage = new RecentChangesWikiPage();
 }
  public void testSymbolicLinkListingForBackwardPath() throws Exception {
    WikiPage page = root.addChildPage("SomePage");
    WikiPage child = page.addChildPage("SomeChild");
    page.addChildPage("OtherChild");

    PageData data = child.getData();
    WikiPageProperties props = data.getProperties();
    WikiPageProperty symProp = props.set(SymbolicPage.PROPERTY_NAME);
    symProp.set("InternalBackPage", "<SomePage.OtherChild");
    page.commit(data);

    getPropertiesContentFromPage(page);

    assertSubString("InternalBackPage", content);
    assertSubString("<a href=\".SomePage.OtherChild\">&lt;SomePage.OtherChild</a>", content);
  }
 public void testMakeSecurityPropertiesHtml() throws Exception {
   WikiPage page = root.addChildPage("SomePage");
   PageData data = page.getData();
   String html = new PropertiesResponder().makeSecurityCheckboxesHtml(data).html();
   assertSubString("<div style=\"float: left; width: 150px;\">Security:", html);
   assertSubString("<input type=\"checkbox\" name=\"secure-read\"/> - secure-read", html);
   assertSubString("<input type=\"checkbox\" name=\"secure-write\"/> - secure-write", html);
   assertSubString("<input type=\"checkbox\" name=\"secure-test\"/> - secure-test", html);
 }
 public void testMakeNavigationPropertiesHtml() throws Exception {
   WikiPage page = root.addChildPage("SomePage");
   PageData data = page.getData();
   String html = new PropertiesResponder().makeNavigationCheckboxesHtml(data).html();
   assertSubString("<div style=\"float: left; width: 150px;\">Navigation:", html);
   assertSubString("<input type=\"checkbox\" name=\"Files\" checked=\"true\"/> - Files", html);
   assertSubString(
       "<input type=\"checkbox\" name=\"RecentChanges\" checked=\"true\"/> - RecentChanges", html);
   assertSubString("<input type=\"checkbox\" name=\"Search\" checked=\"true\"/> - Search", html);
   assertSubString("<input type=\"checkbox\" name=\"Prune\"/> - Prune", html);
 }
 public void loadVirtualChildren(String url) throws Exception {
   try {
     ProxyPage proxy = ProxyPage.retrievePage(url);
     virtualCoupling = new VirtualCouplingPage(hostPage, proxy);
   } catch (Exception e) {
     WikiPage page = hostPage.getChildPage("VirtualWikiNetworkError");
     if (page == null) page = hostPage.addChildPage("VirtualWikiNetworkError");
     PageData data = page.getData();
     data.setContent("{{{" + ErrorResponder.makeExceptionString(e) + "}}}");
     page.commit(data);
   }
 }
  @Test
  public void testMaxSize() throws Exception {
    for (int i = 0; i < 101; i++) {
      StringBuffer b = new StringBuffer("LotsOfAs");
      for (int j = 0; j < i; j++) b.append("a");
      WikiPage page = rootPage.addChildPage(b.toString());
      recentChangesWikiPage.updateRecentChanges(page);
    }

    WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
    List<String> lines = recentChangesWikiPage.getRecentChangesLines(recentChanges.getData());
    assertEquals(100, lines.size());
  }
  private void testWikiImportUpdateWith(WikiImportProperty property) throws Exception {
    WikiPage page = root.addChildPage("SomePage");
    PageData data = page.getData();
    property.addTo(data.getProperties());
    page.commit(data);

    getPropertiesContentFromPage(page);
    checkUpdateForm();
    assertSubString("Wiki Import Update", content);
    assertSubString(
        "<a href=\"http://my.host.com/PageRoot\">http://my.host.com/PageRoot</a>", content);

    assertNotSubString("value=\"Import\"", content);
  }
 public void testActionPropertiesHtml() throws Exception {
   WikiPage page = root.addChildPage("SomePage");
   PageData data = page.getData();
   String html = new PropertiesResponder().makeTestActionCheckboxesHtml(data).html();
   assertSubString("<div style=\"float: left; width: 150px;\">Actions:", html);
   assertSubString("Actions:", html);
   assertSubString("<input type=\"checkbox\" name=\"Test\"/> - Test", html);
   assertSubString("<input type=\"checkbox\" name=\"Suite\"/> - Suite", html);
   assertSubString("<input type=\"checkbox\" name=\"Edit\" checked=\"true\"/> - Edit", html);
   assertSubString(
       "<input type=\"checkbox\" name=\"Versions\" checked=\"true\"/> - Versions", html);
   assertSubString(
       "<input type=\"checkbox\" name=\"Properties\" checked=\"true\"/> - Properties", html);
   assertSubString(
       "<input type=\"checkbox\" name=\"Refactor\" checked=\"true\"/> - Refactor", html);
   assertSubString(
       "<input type=\"checkbox\" name=\"WhereUsed\" checked=\"true\"/> - WhereUsed", html);
 }
Exemple #10
0
  private void addChildFromXml(Element pageElement, WikiPage context, XmlizerPageHandler handler) {
    String name = XmlUtil.getTextValue(pageElement, "name");
    String modifiedDateString = XmlUtil.getTextValue(pageElement, "lastModified");

    Date modifiedDate;
    try {
      modifiedDate =
          modifiedDateString == null ? new Date(0) : dateFormat.parse(modifiedDateString);
    } catch (ParseException e) {
      modifiedDate = new Date(0);
    }

    WikiPage childPage = context.getChildPage(name);
    if (childPage == null) childPage = context.addChildPage(name);
    handler.enterChildPage(childPage, modifiedDate);
    addChildrenFromXml(pageElement, childPage, handler);
    handler.exitPage();
  }
  private WikiPage getContentFromSimplePropertiesPage() throws Exception {
    WikiPage page = root.addChildPage("SomePage");

    return getPropertiesContentFromPage(page);
  }
 private void reloadPages() {
   pageOne = root.getChildPage("PageOne");
   WikiPage pageTwo = root.addChildPage("PageTwo");
   childTwo = pageTwo.addChildPage("ChildTwo");
 }
 public WikiPage addChildPage(String name) throws Exception {
   return realPage.addChildPage(name);
 }