Package fitnesse.wiki

Examples of fitnesse.wiki.WikiPageProperties


  @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


  private void removeSymbolicLink(Request request, WikiPage page) {
    String linkToRemove = (String) request.getInput("removal");

    PageData data = page.getData();
    WikiPageProperties properties = data.getProperties();
    WikiPageProperty symLinks = getSymLinkProperty(properties);
    symLinks.remove(linkToRemove);
    if (symLinks.keySet().size() == 0)
      properties.remove(SymbolicPage.PROPERTY_NAME);
    page.commit(data);
    setRedirect(resource);
  }
View Full Code Here

    String linkToRename = (String) request.getInput("rename"),
    newName = (String) request.getInput("newname");

    if (isValidWikiPageName(newName)) {
      PageData data = page.getData();
      WikiPageProperties properties = data.getProperties();
      WikiPageProperty symLinks = getSymLinkProperty(properties);
      String currentPath = symLinks.get(linkToRename);
      symLinks.remove(linkToRename);
      symLinks.set(newName, currentPath);
      page.commit(data);
View Full Code Here

    String linkName = StringUtils.trim((String) request.getInput("linkName"));
    String linkPath = StringUtils.trim((String) request.getInput("linkPath"));

    if (isValidLinkPathName(linkPath) && isValidWikiPageName(linkName)) {
      PageData data = page.getData();
      WikiPageProperties properties = data.getProperties();
      WikiPageProperty symLinks = getSymLinkProperty(properties);
      symLinks.set(linkName, linkPath);
      page.commit(data);
      setRedirect(resource);
    }
View Full Code Here

      content = fileSystem.getContent(path);
    } catch (IOException e) {
      throw new RuntimeException("Unable to fetch page content", e);
    }

    WikiPageProperties properties = new WikiPageProperties();
    if (content.contains("<table")) {
      properties.set(PageType.TEST.toString());
    }
    properties.set(PageData.PropertyWHERE_USED);
    properties.set(PageData.PropertyRECENT_CHANGES);
    properties.set(PageData.PropertyFILES);
    properties.set(PageData.PropertyVERSIONS);
    properties.set(PageData.PropertySEARCH);
    properties.setLastModificationTime(Clock.currentDate());
    return new PageData("!-" + content + "-!", properties);

  }
View Full Code Here

  }

  private PageData getDataVersion() {
    FileVersion[] versions = versionsController.getRevisionData(versionName, contentFile(), propertiesFile());
    String content = "";
    WikiPageProperties properties = null;
    try {
      for (FileVersion version : versions) {
        if (version == null) continue;
        if (contentFilename.equals(version.getFile().getName())) {
          content = loadContent(version);
View Full Code Here

    }
    return new PageData(content, properties);
  }

  public WikiPageProperties defaultPageProperties() {
    WikiPageProperties properties = new WikiPageProperties();
    if (!isErrorLogsPage()) {
      properties.set(PageData.PropertyEDIT);
      properties.set(PageData.PropertyPROPERTIES);
      properties.set(PageData.PropertyREFACTOR);
    }
    properties.set(PageData.PropertyWHERE_USED);
    properties.set(PageData.PropertyRECENT_CHANGES);
    properties.set(PageData.PropertyFILES);
    properties.set(PageData.PropertyVERSIONS);
    properties.set(PageData.PropertySEARCH);
    properties.setLastModificationTime(Clock.currentDate());

    if (isErrorLogsPage())
      return properties;

    PageType pageType = PageType.getPageTypeForPageName(getName());

    if (STATIC.equals(pageType))
      return properties;

    properties.set(pageType.toString());
    return properties;
  }
View Full Code Here

      content.close();
    }
  }

  private WikiPageProperties loadAttributes(final FileVersion fileVersion) throws IOException {
    final WikiPageProperties props = new WikiPageProperties();
    InputStream content = fileVersion.getContent();
    try {
      props.loadFromXmlStream(content);
    } finally {
      content.close();
    }
    props.setLastModificationTime(fileVersion.getLastModificationTime());
    return props;
  }
View Full Code Here

    remotePath.addNameToEnd(childPage.getName());
    relativePath.addNameToEnd(childPage.getName());
    localPath.addNameToEnd(childPage.getName());

    PageData data = childPage.getData();
    WikiPageProperties props = data.getProperties();
    WikiImportProperty importProps = WikiImportProperty.createFrom(props);
    if (importProps != null) {
      Date lastRemoteModification = importProps.getLastRemoteModificationTime();
      if (lastModified.after(lastRemoteModification))
        importRemotePageContent(childPage);
View Full Code Here

    }
  }

  public void configureAutoUpdateSetting(WikiPage page) {
    PageData data = page.getData();
    WikiPageProperties props = data.getProperties();
    WikiImportProperty importProps = WikiImportProperty.createFrom(props);
    if (importProps != null)
      configureAutoUpdateSetting(importProps, data, page);
  }
View Full Code Here

TOP

Related Classes of fitnesse.wiki.WikiPageProperties

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.