Package fitnesse.wiki

Examples of fitnesse.wiki.PageData


    return "line 1\nline 2\nline 3\nmatching line\nline 5\nmatching line\nline 7";
  }

  private WikiPage createPageWithContent(String pageContent) throws Exception {
    WikiPage wikiPage = InMemoryPage.makeRoot("wikiPage");
    PageData pageData = wikiPage.getData();
    pageData.setContent(pageContent);
    wikiPage.commit(pageData);
    return wikiPage;
  }
View Full Code Here


  }

  @Test
  public void testUnicodeCharacters() throws Exception {
    WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("SomePage"), "\uba80\uba81\uba82\uba83");
    PageData data = page.getData();
    assertEquals("\uba80\uba81\uba82\uba83", data.getContent());
  }
View Full Code Here

    versionsController = new ZipFileVersionsController();
    FileSystemPageFactory fileSystemPageFactory = new FileSystemPageFactory(new DiskFileSystem(), versionsController, new SystemVariableSource());
    root = fileSystemPageFactory.makePage(new File("TestDir/RooT"), "RooT", null);
    page = (FileSystemPage) WikiPageUtil.addPage(root, PathParser.parse("PageOne"), "original content");

    PageData data = page.getData();
    firstVersion = VersionInfo.makeVersionInfo(data);
    secondVersion = page.commit(data);
  }
View Full Code Here

    assertTrue(list.contains(firstVersion + ".zip"));
  }

  @Test
  public void originalContentCanBeRetrievedViaVersionInfo() throws Exception {
    PageData data = page.getData();
    data.setContent("new content");
    VersionInfo version = page.commit(data);

    PageData loadedData = page.getVersion(version.getName()).getData();
    assertEquals("original content", loadedData.getContent());
  }
View Full Code Here

    }
  }

  @Test
  public void canRetrieveVersions() throws Exception {
    PageData data = page.getData();
    data.setContent("new content");
    page.commit(data);
    Collection<VersionInfo> versionNames = page.getVersions();
    assertEquals(versionNames.toString(), 2, versionNames.size());
    assertTrue(versionNames.contains(firstVersion));
    assertTrue(versionNames.contains(secondVersion));
View Full Code Here

  }

  @Test
  public void oldVersionsAreRemovedOnCommit() throws Exception {
    versionsController.setHistoryDepth(3);
    PageData data = page.getData();

    Calendar modificationTime = Calendar.getInstance();
    modificationTime.add(Calendar.DATE, -1);
    String timeIndex1 = format(modificationTime);
    data.getProperties().setLastModificationTime(dateFormat().parse(timeIndex1));
    page.commit(data);
    modificationTime.add(Calendar.DATE, -1);
    String timeIndex2 = format(modificationTime);
    data.getProperties().setLastModificationTime(dateFormat().parse(timeIndex2));
    page.commit(data);
    modificationTime.add(Calendar.DATE, -1);
    data.getProperties().setLastModificationTime(dateFormat().parse(format(modificationTime)));
    page.commit(data);
    modificationTime.add(Calendar.DATE, -1);
    data.getProperties().setLastModificationTime(dateFormat().parse(format(modificationTime)));
    page.commit(data);

    Collection<VersionInfo> versions = page.getVersions();
    assertEquals(3, versions.size());
View Full Code Here

  @Test
  public void testGetContent() throws Exception {
    WikiPagePath alpha = PathParser.parse("AlphaAlpha");
    WikiPage a = WikiPageUtil.addPage(root, alpha, "a");

    PageData data = a.getData();
    assertEquals("a", data.getContent());
  }
View Full Code Here

  @Test
  public void testReplaceContent() throws Exception {
    WikiPagePath alpha = PathParser.parse("AlphaAlpha");
    WikiPage page = WikiPageUtil.addPage(root, alpha, "a");

    PageData data = page.getData();
    data.setContent("b");
    page.commit(data);
    assertEquals("b", page.getData().getContent());
  }
View Full Code Here

    assertEquals("b", page.getData().getContent());
  }

  @Test
  public void testSetAttributes() throws Exception {
    PageData data = root.getData();
    data.setAttribute("Test", "true");
    data.setAttribute("Search", "true");
    root.commit(data);
    assertTrue(root.getData().hasAttribute("Test"));
    assertTrue(root.getData().hasAttribute("Search"));

    assertEquals("true", root.getData().getAttribute("Test"));
View Full Code Here

  @Test
  public void testSimpleVersionTasks() throws Exception {
    WikiPagePath path = PathParser.parse("MyPageOne");
    WikiPage page = WikiPageUtil.addPage(root, path, "old content");
    PageData data = page.getData();
    data.setContent("new content");
    VersionInfo previousVersion = page.commit(data);

    Collection<VersionInfo> versions = page.getVersions();
    assertEquals(1, versions.size());
    assertEquals(true, versions.contains(previousVersion));
View Full Code Here

TOP

Related Classes of fitnesse.wiki.PageData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.