示例#1
0
  public void testChildPageAdded() throws Exception {
    importer.enterChildPage(pageOne, Clock.currentDate());
    importer.enterChildPage(childPageOne, Clock.currentDate());

    PageData data = childPageOne.getData();
    assertEquals("child one", data.getContent());
  }
示例#2
0
  public void testExiting() throws Exception {
    importer.enterChildPage(pageOne, Clock.currentDate());
    importer.enterChildPage(childPageOne, Clock.currentDate());
    importer.exitPage();
    importer.exitPage();
    importer.enterChildPage(pageTwo, Clock.currentDate());

    PageData data = pageTwo.getData();
    assertEquals("page two", data.getContent());
  }
 @Test
 public void testLastModifiedTime() throws Exception {
   WikiPage page = crawler.addPage(root, PathParser.parse("SomePage"), "some text");
   page.commit(page.getData());
   long now = Clock.currentTimeInMillis();
   Date lastModified = page.getData().getProperties().getLastModificationTime();
   assertTrue(now - lastModified.getTime() <= 5000);
 }
示例#4
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());
  }
示例#5
0
  public void testEnterChildPageWhenRemotePageNotModified() throws Exception {
    importer.enterChildPage(pageOne, Clock.currentDate());
    importer.exitPage();

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

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

    assertEquals("new content", pageOne.getData().getContent());
  }
示例#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());
  }
示例#7
0
 private String makeRightColumn() throws Exception {
   HtmlTag form = HtmlUtil.makeFormTag("post", resource);
   form.add(HtmlUtil.makeInputTag("hidden", "responder", "saveData"));
   form.add(
       HtmlUtil.makeInputTag(
           "hidden", EditResponder.TIME_STAMP, String.valueOf(clock.currentClockTimeInMillis())));
   form.add(
       HtmlUtil.makeInputTag(
           "hidden", EditResponder.TICKET_ID, String.valueOf(SaveRecorder.newTicket())));
   HtmlTag title = HtmlUtil.makeDivTag("centered");
   title.use(
       "This page has been recently modified.  You may want to merge existing page content into your changes.");
   form.add(title);
   form.add(makeMergeNewDivTag());
   form.add(makeMergeOldDivTag());
   form.add(addHiddenAttributes());
   return form.html();
 }
示例#8
0
 @After
 public void tearDown() {
   Clock.restoreDefaultClock();
 }
 protected VersionInfo makeVersion() {
   return new VersionInfo("abc", "Jon", Clock.currentDate());
 }
 @After
 public void restoreDefaultClock() {
   Clock.restoreDefaultClock();
 }