Package fitnesse.wiki

Examples of fitnesse.wiki.PageData


  @Test
  public void testUserNameIsInVersionName() throws Exception {
    WikiPagePath testPagePath = PathParser.parse("TestPage");
    WikiPage testPage = WikiPageUtil.addPage(root, testPagePath, "version1");

    PageData data = testPage.getData();
    data.setAttribute(PageData.LAST_MODIFYING_USER, "Aladdin");
    VersionInfo record = testPage.commit(data);

    assertTrue(record.getName().startsWith("Aladdin"));
  }
View Full Code Here


  }

  @Test
  public void testUnicodeInVersions() throws Exception {
    WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("SomePage"), "\uba80\uba81\uba82\uba83");
    PageData data = page.getData();
    data.setContent("blah");
    VersionInfo info = page.commit(data);

    data = page.getVersion(info.getName()).getData();
    String expected = "\uba80\uba81\uba82\uba83";
    String actual = data.getContent();

    assertEquals(expected, actual);
  }
View Full Code Here

  }

  @Test
  public void testVersionedPropertiedLoadedProperly() throws Exception {
    WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("TestPage"));
    PageData data = page.getData();
    WikiPageProperties oldProps = data.getProperties();
    WikiPageProperties props = new WikiPageProperties();
    props.set("MyProp", "my value");
    data.setProperties(props);
    page.commit(data);

    data.setProperties(oldProps);
    VersionInfo version = page.commit(data);

    PageData versionedData = page.getVersion(version.getName()).getData();
    WikiPageProperties versionedProps = versionedData.getProperties();

    assertTrue(versionedProps.has("MyProp"));
    assertEquals("my value", versionedProps.get("MyProp"));
  }
View Full Code Here

    return new AttributeWikiPageFinder(this, pageTypes, attributes, new ArrayList<String>());
  }

  private void removePageProperty(WikiPage page, String attributeName)
      throws Exception {
    PageData pageData = page.getData();
    pageData.getProperties().remove(attributeName);
    page.commit(pageData);
  }
View Full Code Here

    pageData.getProperties().remove(attributeName);
    page.commit(pageData);
  }

  private void setPageProperty(WikiPage page, String propertyName) {
    PageData pageData = page.getData();
    pageData.setAttribute(propertyName);
    page.commit(pageData);
  }
View Full Code Here

  }


  private void setPageProperty(WikiPage page, String propertyName,
      String propertyValue) {
    PageData pageData = page.getData();
    pageData.setAttribute(propertyName, propertyValue);
    page.commit(pageData);
  }
View Full Code Here

    page2 = WikiPageUtil.addPage(root, PathParser.parse("PageTwo"), "page two");
  }

  @Test
  public void testVersions() throws Exception {
    PageData data = page1.getData();
    data.setContent("version 1");
    page1.commit(data);
    data.setContent("version 2");
    page1.commit(data);

    data = page1.getData();
    Collection<VersionInfo> versions = page1.getVersions();
View Full Code Here

    assertEquals(3, versions.size());
  }

  @Test
  public void testVersionAuthor() throws Exception {
    PageData data = page1.getData();
    Collection<VersionInfo> versions = page1.getVersions();
    for (Iterator<VersionInfo> iterator = versions.iterator(); iterator.hasNext();) {
      VersionInfo versionInfo = iterator.next();
      assertEquals("", versionInfo.getAuthor());
    }

    data.setAttribute(PageData.LAST_MODIFYING_USER, "Joe");
    page1.commit(data);
    page1.commit(data);

    data = page1.getData();
    versions = page1.getVersions();
View Full Code Here

    request.setResource("FrontPage");
    context = FitNesseUtil.makeTestContext(root);
  }

  private void makeReadSecure(WikiPage frontpage) {
    PageData data = frontpage.getData();
    data.setAttribute(PageData.PropertySECURE_READ);
    frontpage.commit(data);
  }
View Full Code Here

  public void shouldLoadMostRecentVersion() {
    WikiPage root = wikiPageFactory.makePage(new File("."), "RooT", null);
    VersionInfo version = root.commit(root.getData());

    WikiPage versionData = root.getVersion(version.getName());
    PageData newData = versionData.getData();

    assertEquals("0", version.getName());
    assertNotNull(newData);
  }
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.