Ejemplo n.º 1
0
 @Test
 public void DirectoryWithContentIsFileSystemPage() throws Exception {
   fileSystem.makeFile("./somepath/WikiPage/content.txt", "stuff");
   fileSystem.makeFile("./somepath/WikiPage/subsuite/myfile.html", "stuff");
   WikiPage page = pageRepository.makeChildPage("WikiPage", rootPage);
   assertEquals(FileSystemPage.class, page.getClass());
 }
Ejemplo n.º 2
0
 @Test
 public void DirectoryOfHtmlFilesIsExternalSuitePageChild() throws Exception {
   fileSystem.makeFile("./somepath/ExternalSuite/subsuite/myfile.html", "stuff");
   ExternalSuitePage page =
       (ExternalSuitePage) pageRepository.makeChildPage("ExternalSuite", rootPage);
   WikiPage child = pageRepository.findChildren(page).get(0);
   assertEquals(ExternalSuitePage.class, child.getClass());
   assertEquals("SubsuitE", child.getName());
 }
  private void executeSymbolicLinkTestWith(String linkName, String linkPath) throws Exception {
    request.addInput("linkName", linkName);
    request.addInput("linkPath", linkPath);
    Response response = invokeResponder();

    checkPageOneRedirectToProperties(response);

    WikiPage symLink = pageOne.getChildPage("SymLink");
    assertNotNull(symLink);
    assertEquals(SymbolicPage.class, symLink.getClass());
  }
  @Test
  public void testSubmitFormForLinkToExternalRoot() throws Exception {
    // Ise canonical names, since that's how they will be resolved.
    fileSystem.makeDirectory(new File("/somedir"));
    fileSystem.makeDirectory(new File("/somedir/ExternalRoot"));

    request.addInput("linkName", "SymLink");
    request.addInput("linkPath", "file:/somedir/ExternalRoot");
    Response response = invokeResponder();

    checkPageOneRedirectToProperties(response);

    WikiPage symLink = pageOne.getChildPage("SymLink");
    assertNotNull(symLink);
    assertEquals(SymbolicPage.class, symLink.getClass());

    WikiPage realPage = ((SymbolicPage) symLink).getRealPage();
    assertEquals(WikiFilePage.class, realPage.getClass());
    assertEquals(
        new File("/somedir/ExternalRoot"), ((FileBasedWikiPage) realPage).getFileSystemPath());
  }
  @Test
  public void testSubmitGoodFormToSibling() throws Exception {
    request.addInput("linkName", "SymTwo");
    request.addInput("linkPath", "PageTwo");
    Response response = invokeResponder();

    checkPageOneRedirectToProperties(response);

    WikiPage symLink = pageOne.getChildPage("SymTwo");
    assertNotNull(symLink);
    assertEquals(SymbolicPage.class, symLink.getClass());
  }
  @Test
  public void testSubmitGoodFormToBackwardRelative() throws Exception {
    request.setResource("PageTwo.ChildTwo");
    request.addInput("linkName", "SymLink");
    request.addInput("linkPath", "<PageTwo.ChildThree");
    Response response = invokeResponder();

    checkChildTwoRedirectToProperties(response);

    WikiPage symLink = childTwo.getChildPage("SymLink");
    assertNotNull(symLink);
    assertEquals(SymbolicPage.class, symLink.getClass());
  }
  @Test
  public void testReplaceAllowedOnSymChild() throws Exception {
    request.addInput("linkName", "SymLink");
    request.addInput("linkPath", "PageTwo");
    Response response = invokeResponder();

    request.addInput("linkName", "SymLink");
    request.addInput("linkPath", ">ChildOne");
    response = invokeResponder();

    checkPageOneRedirectToProperties(response);

    WikiPage symLink = pageOne.getChildPage("SymLink");
    assertNotNull(symLink);
    assertEquals(SymbolicPage.class, symLink.getClass());
    assertTrue(symLink.getHtml().contains("ChildOne"));
  }
Ejemplo n.º 8
0
 @Test
 public void DirectoryOfDirectoryOfHtmlFilesIsExternalSuitePage() throws Exception {
   fileSystem.makeFile("./somepath/ExternalSuite/subsuite/myfile.html", "stuff");
   WikiPage page = pageRepository.makeChildPage("ExternalSuite", rootPage);
   assertEquals(ExternalSuitePage.class, page.getClass());
 }