Пример #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();
 }
Пример #9
0
 protected VersionInfo makeVersion() {
   return new VersionInfo("abc", "Jon", Clock.currentDate());
 }
Пример #10
0
 @After
 public void restoreDefaultClock() {
   Clock.restoreDefaultClock();
 }