Example #1
0
  public void testAutoUpdate_NewPage() throws Exception {
    importer.setAutoUpdateSetting(true);
    importer.enterChildPage(pageOne, Clock.currentDate());

    WikiImportProperty importProps =
        WikiImportProperty.createFrom(pageOne.getData().getProperties());
    assertTrue(importProps.isAutoUpdate());
  }
 private void makeImportUpdateForm(WikiImportProperty importProps) {
   if (importProps.isRoot()) {
     html.put("makeImportRootForm", true);
   } else {
     html.put("makeImportSubpageForm", true);
   }
   if (importProps.isAutoUpdate()) html.put("autoUpdate", true);
   html.put("sourceUrl", importProps.getSourceUrl());
 }
 private void addImportPropertyToPage(WikiPage page, boolean isRoot, boolean autoUpdate)
     throws Exception {
   PageData data = page.getData();
   String sourceUrl = FitNesseUtil.URL + "PageOne";
   WikiImportProperty importProps = new WikiImportProperty(sourceUrl);
   importProps.setRoot(isRoot);
   importProps.setAutoUpdate(autoUpdate);
   importProps.addTo(data.getProperties());
   pageOne.commit(data);
 }
  @Test
  public void testImportedPageIndication() throws Exception {
    final WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("SamplePage"));
    final PageData data = page.getData();
    final WikiImportProperty importProperty = new WikiImportProperty("blah");
    importProperty.addTo(data.getProperties());
    page.commit(data);

    final String content = requestPage("SamplePage").getContent();

    assertSubString("<body class=\"imported\">", content);
  }
Example #5
0
  private WikiPage addLocalPageWithImportProperty(
      WikiPage parentPage, String pageName, boolean isRoot) throws Exception {
    WikiPage page = parentPage.addChildPage(pageName);
    PageData data = page.getData();

    WikiPagePath pagePath = localRoot.getPageCrawler().getFullPath(page);
    WikiImportProperty importProps =
        new WikiImportProperty(
            "http://localhost:" + FitNesseUtil.port + "/" + PathParser.render(pagePath));
    if (isRoot) importProps.setRoot(true);
    importProps.addTo(data.getProperties());
    page.commit(data);

    return page;
  }
Example #6
0
  public void testAutoUpdateWhenRemotePageNotModified() throws Exception {
    importer.enterChildPage(pageOne, Clock.currentDate());
    importer.exitPage();

    PageData data = pageOne.getData();
    data.setContent("new content");
    pageOne.commit(data);

    importer.setAutoUpdateSetting(true);
    importer.enterChildPage(pageOne, new Date(0));

    WikiImportProperty importProps =
        WikiImportProperty.createFrom(pageOne.getData().getProperties());
    assertTrue(importProps.isAutoUpdate());
  }
Example #7
0
  public void testAutoUpdatePropertySetOnRoot() throws Exception {
    addLocalPageWithImportProperty(localRoot, "PageOne", false);
    importer.parseUrl("http://localhost:" + FitNesseUtil.port + "/PageOne");
    importer.setAutoUpdateSetting(true);
    WikiPage importedPage = localRoot.getChildPage("PageOne");
    importer.importWiki(importedPage);

    WikiImportProperty importProp =
        WikiImportProperty.createFrom(importedPage.getData().getProperties());
    assertTrue(importProp.isAutoUpdate());

    importer.setAutoUpdateSetting(false);
    importer.importWiki(importedPage);

    importProp = WikiImportProperty.createFrom(importedPage.getData().getProperties());
    assertFalse(importProp.isAutoUpdate());
  }
  private void makeFormSections() {
    makePropertiesForm();

    WikiImportProperty importProperty = WikiImportProperty.createFrom(pageData.getProperties());
    if (importProperty != null) makeImportUpdateForm(importProperty);
    else makeImportForm();

    makeSymbolicLinkSection();
  }
  public void doExecuteTests() {
    if (WikiImportProperty.isImported(data)) {
      importWikiPages();
    }

    try {
      performExecution();
    } catch (Exception e) {
      // Is this necessary? Or is the exception already handled by stopTestSystem?
      mainFormatter.errorOccurred(e);
      LOG.log(Level.WARNING, "error registered in test system", e);
    }

    exitCode = mainFormatter.getErrorCount();
  }